lkml.org 
[lkml]   [2018]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2018-09-13 17:56    [W:0.038 / U:1.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site