oom_kill: change oom_kill.c to use for_each_thread()

Change oom_kill.c to use for_each_thread() rather than the racy
while_each_thread() which can loop forever if we race with exit.

Note also that most users were buggy even if while_each_thread() was
fine, the task can exit even _before_ rcu_read_lock().

Fortunately the new for_each_thread() only requires the stable
task_struct, so this change fixes both problems.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Sergey Dyasly <dserrg@gmail.com>
Tested-by: Sergey Dyasly <dserrg@gmail.com>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mandeep Singh Baines <msb@chromium.org>
Cc: "Ma, Xindong" <xindong.ma@intel.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: "Tu, Xiaobing" <xiaobing.tu@intel.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Conflicts:
	mm/oom_kill.c

Change-Id: I5219bcef6d4cdbbea8c66423bcff4ea92d9e7c23
'Revert "msm: camera: Enable interrupts before returning during Invalid Image mode."

This reverts commit e6f398d23b8a7ad154ad1f9a7e7c9ae4d6f0b22f.

Change-Id: Ib18e458055695322cf34c73da5e7113ec7ee6cbd
Signed-off-by: Vijaya Kumar T M <vtmuni@codeaurora.org>
msm: camera: Enable interrupts before returning during Invalid Image mode.

CRs-Fixed:649474
Change-Id: Ifd77870dc888232ddc665e0e29974aa6d23db77e
Signed-off-by: Vijaya Kumar T M <vtmuni@codeaurora.org>