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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 13 Sep 2018 17:55:43 +0200
From:   Oleg Nesterov <oleg@...hat.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Dmitry Vyukov <dvyukov@...gle.com>,
        Michal Hocko <mhocko@...nel.org>,
        "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] introduce for_each_process_thread_break() and
 for_each_process_thread_continue()

On 09/12, Andrew Morton wrote:
>
> > Usage:
> >
> > 	rcu_read_lock();
> > 	for_each_process_thread(p, t) {
> > 		do_something_slow(p, t);
> >
> > 		if (SPENT_TOO_MUCH_TIME) {
> > 			for_each_process_thread_break(p, t);
> > 			rcu_read_unlock();
> > 			schedule();
> > 			rcu_read_lock();
> > 			for_each_process_thread_continue(&p, &t);
> > 		}
> > 	}
> > 	rcu_read_unlock();

...

> > +static inline void
> > +for_each_process_thread_break(struct task_struct *p, struct task_struct *t)
> > +{
> > +	get_task_struct(p);
> > +	get_task_struct(t);
> > +}
> > +
> > +extern void
> > +for_each_process_thread_continue(struct task_struct **, struct task_struct **);
>
> These things will need some documentation, please.  What they do, why
> they do it, how people should use them, when and why they should use
> them.  Etcetera!  This is tricky stuff.

See "Usage" above, this is as simple as list_for_each_entry_continue_rcu(),
just you need to call _break() first.

OK, I'll try to add some comments and send V2.

> Should these be available to modules, like the rest of these things
> appear to be?  Or we could do that later if a need is shown.

Yes, I think this can be exported on demand,

Oleg.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ