tes update
tes update 85
oom: use N_MEMORY instead N_HIGH_MEMORY
 introduce for_each_thread() to replace the buggy while_each_thread()

while_each_thread() and next_thread() should die, almost every lockless
usage is wrong.

1. Unless g == current, the lockless while_each_thread() is not safe.

   while_each_thread(g, t) can loop forever if g exits, next_thread()
   can't reach the unhashed thread in this case. Note that this can
   happen even if g is the group leader, it can exec.

2. Even if while_each_thread() itself was correct, people often use
   it wrongly.

   It was never safe to just take rcu_read_lock() and loop unless
   you verify that pid_alive(g) == T, even the first next_thread()
   can point to the already freed/reused memory.

This patch adds signal_struct->thread_head and task->thread_node to
create the normal rcu-safe list with the stable head.  The new
for_each_thread(g, t) helper is always safe under rcu_read_lock() as
long as this task_struct can't go away.

Note: of course it is ugly to have both task_struct->thread_node and the
old task_struct->thread_group, we will kill it later, after we change
the users of while_each_thread() to use for_each_thread().

Perhaps we can kill it even before we convert all users, we can
reimplement next_thread(t) using the new thread_head/thread_node.  But
we can't do this right now because this will lead to subtle behavioural
changes.  For example, do/while_each_thread() always sees at least one
task, while for_each_thread() can do nothing if the whole thread group
has died.  Or thread_group_empty(), currently its semantics is not clear
unless thread_group_leader(p) and we need to audit the callers before we
can change it.

So this patch adds the new interface which has to coexist with the old
one for some time, hopefully the next changes will be more or less
straightforward and the old one will go away soon.

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> Acked-by: David Rientjes
<rientjes@google.com> 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> Cc: Michal
Hocko <mhocko@suse.cz> Cc: "Tu, Xiaobing" <xiaobing.tu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Paul
Reioux <reioux@gmail.com> Signed-off-by: Matt Khojim
<mattkhojim@gmail.com>

backported to Linux 3.4

Conflicts:
	kernel/fork.c
mm, oom: normalize oom scores to oom_score_adj scale only for userspace
mm, oom: fix badness score underflow
mm, oom: fix and cleanup oom score calculations
mm, oom: move declaration for mem_cgroup_out_of_memory to oom.h
mm, oom: introduce helper function to process threads during scan
mm, memcg: introduce own oom handler to iterate only over its own thread
mm, oom: reduce dependency on tasklist_lock
mm, memcg: move all oom handling to memcontrol.c
mm, oom: allow exiting threads to have access to memory reserves
mm, oom: cleanup pagefault oom handler
mm/oom_kill: remove weird use of ERR_PTR()/PTR_ERR().
oom_kill: change oom_kill.c to use for_each_thread()
oom_kill: has_intersects_mems_allowed() needs rcu_read_lock()
oom_kill: add rcu_read_lock() into find_lock_task_mm()
mm, oom: prefer thread group leaders for display purposes
mm, oom: base root bonus on current usage