Re: [-mm] Add an owner to the mm_struct (v9)

From: KAMEZAWA Hiroyuki
Date: Fri Apr 11 2008 - 00:43:46 EST


On Fri, 11 Apr 2008 09:57:06 +0530
Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> wrote:

> KAMEZAWA Hiroyuki wrote:
> > maybe I don't undestand correctlly...
> >
> > On Thu, 10 Apr 2008 14:46:02 +0530
> > Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> wrote:
> >
> >>
> >> +config MM_OWNER
> >> + bool
> >> +
> > no default is ok here ? what value will this have if not selected ?
> > I'm sorry if I misunderstand Kconfig.
> >
>
> The way this works is
>
> If I select memory resource controller, CONFIG_MM_OWNER is set to y, else it
> does not even show up in the .config
>
ok, sorry for noise.

> >
> >> + /*
> >> + * Search through everything else. We should not get
> >> + * here often
> >> + */
> >> + do_each_thread(g, c) {
> >> + if (c->mm == mm)
> >> + goto assign_new_owner;
> >> + } while_each_thread(g, c);
> >> +
> >
> > Again, do_each_thread() is suitable here ?
> > for_each_process() ?
> >
>
> do_each_thread(), while_each_thread() walks all processes and threads of those
> processes in the system. It is a common pattern used in the kernel (see
> try_to_freeze_tasks() or oom_kill_task() for example).
>

What you want is finding a thread which has the "mm_struct". Why search all
threads ? I think you only have to search processes(i.e. thread-group-leaders).

try_to_freeze_tasks()/oom_kill_task() have to chase all threads because
it have to check flags in task_structs in a process.


Thanks,
-Kame



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/