Vasiliy Kulikov 26c4caea9d taskstats: don't allow duplicate entries in listener mode
Currently a single process may register exit handlers unlimited times.
It may lead to a bloated listeners chain and very slow process
terminations.

Eg after 10KK sent TASKSTATS_CMD_ATTR_REGISTER_CPUMASKs ~300 Mb of
kernel memory is stolen for the handlers chain and "time id" shows 2-7
seconds instead of normal 0.003.  It makes it possible to exhaust all
kernel memory and to eat much of CPU time by triggerring numerous exits
on a single CPU.

The patch limits the number of times a single process may register
itself on a single CPU to one.

One little issue is kept unfixed - as taskstats_exit() is called before
exit_files() in do_exit(), the orphaned listener entry (if it was not
explicitly deregistered) is kept until the next someone's exit() and
implicit deregistration in send_cpu_listeners().  So, if a process
registered itself as a listener exits and the next spawned process gets
the same pid, it would inherit taskstats attributes.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-06-27 18:00:13 -07:00
..
2011-03-31 11:26:23 -03:00
2010-08-09 16:48:42 -04:00
2010-07-14 11:29:46 +02:00
2011-03-31 11:26:23 -03:00
2011-03-14 09:15:23 -04:00
2010-10-30 01:42:19 -04:00
2011-05-19 18:51:57 +10:00
2011-05-26 17:12:34 -07:00
2011-03-31 11:26:23 -03:00
2011-05-29 11:32:28 -07:00
2011-05-17 23:19:17 +02:00
2010-10-01 10:50:58 -07:00
2011-03-31 11:26:23 -03:00
2011-05-26 17:12:34 -07:00
2011-05-26 17:12:34 -07:00
2011-03-31 11:26:23 -03:00
2011-04-18 10:35:30 -07:00
2011-05-24 12:10:51 +02:00
2011-05-20 12:50:29 -07:00
2011-03-31 11:26:23 -03:00
2011-04-24 13:18:38 +02:00
2011-06-14 19:12:17 -07:00
2011-03-23 19:46:51 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00