lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 2 Aug 2016 13:58:50 +0200 From: Peter Zijlstra <peterz@...radead.org> To: Oleg Nesterov <oleg@...hat.com> Cc: Andrew Morton <akpm@...ux-foundation.org>, Dave Anderson <anderson@...hat.com>, Ingo Molnar <mingo@...nel.org>, "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>, Wang Shu <shuwang@...hat.com>, linux-kernel@...r.kernel.org Subject: Re: [PATCH 1/3] introduce for_each_process_thread_{break,continue}() helpers On Mon, Jul 25, 2016 at 06:23:48PM +0200, Oleg Nesterov wrote: > +void for_each_process_thread_continue(struct task_struct **p_leader, > + struct task_struct **p_thread) > +{ > + struct task_struct *leader = *p_leader, *thread = *p_thread; > + struct task_struct *prev, *next; > + u64 start_time; > + > + if (pid_alive(thread)) { > + /* mt exec could change the leader */ > + *p_leader = thread->group_leader; > + } else if (pid_alive(leader)) { > + start_time = thread->start_time; > + prev = leader; > + > + for_each_thread(leader, next) { > + if (next->start_time > start_time) > + break; > + prev = next; > + } This, > + *p_thread = prev; > + } else { > + start_time = leader->start_time; > + prev = &init_task; > + > + for_each_process(next) { > + if (next->start_time > start_time) > + break; > + prev = next; > + } and this, could be 'SPEND_TOO_MUCH_TIME' all by themselves. Unlikely though, nor do I really have a better suggestion :/ > + > + *p_leader = prev; > + /* a new thread can come after that, but this is fine */ > + *p_thread = list_last_entry(&prev->signal->thread_head, > + struct task_struct, > + thread_node); > + } > + > + put_task_struct(leader); > + put_task_struct(thread); > +}
Powered by blists - more mailing lists