Re: [PATCH 2/4] oom: kill younger process first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 12 May 2011 11:23:38 +0900
Minchan Kim <minchan.kim@xxxxxxxxx> wrote:

> On Thu, May 12, 2011 at 10:53 AM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> > On Thu, 12 May 2011 10:30:45 +0900
> > Minchan Kim <minchan.kim@xxxxxxxxx> wrote:

> > As above implies, (B)->prev pointer is invalid pointer after list_del().
> > So, there will be race with list modification and for_each_list_reverse under
> > rcu_read__lock()
> >
> > So, when you need to take atomic lock (as tasklist lock is) is...
> >
> > Â1) You can't check 'entry' is valid or not...
> > Â ÂIn above for_each_list_rcu(), you may visit an object which is under removing.
> > Â ÂYou need some flag or check to see the object is valid or not.
> >
> > Â2) you want to use list_for_each_safe().
> > Â ÂYou can't do list_del() an object which is under removing...
> >
> > Â3) You want to walk the list in reverse.
> >
> > Â3) Some other reasons. For example, you'll access an object pointed by the
> > Â Â'entry' and the object is not rcu safe.
> >
> > make sense ?
> 
> Yes. Thanks, Kame.
> It seems It is caused by prev poisoning of list_del_rcu.
> If we remove it, isn't it possible to traverse reverse without atomic lock?
> 

IIUC, it's possible (Fix me if I'm wrong) but I don't like that because of 2 reasons.

1. LIST_POISON is very important information at debug.

2. If we don't clear prev pointer, ok, we'll allow 2 directional walk of list
   under RCU.
   But, in following case
   1. you are now at (C). you'll visit (C)->next...(D)
   2. you are now at (D). you want to go back to (C) via (D)->prev.
   3. But (D)->prev points to (B)

  It's not a 2 directional list, something other or broken one.
  Then, the rculist is 1 directional list in nature, I think. 

So, without very very big reason, we should keep POISON.

Thanks,
-Kame










--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]