Re: [PATCH] mm: preallocate page before lock_page at filemap COW.(WasRe: [PATCH V2] mm: Do not keep page locked during page fault whilecharging it for memcg
From: Michal Hocko
Date: Thu Jun 23 2011 - 07:59:01 EST
On Thu 23-06-11 19:01:57, KAMEZAWA Hiroyuki wrote:
> On Thu, 23 Jun 2011 11:02:04 +0200
> Michal Hocko <mhocko@xxxxxxx> wrote:
> > On Thu 23-06-11 17:08:11, KAMEZAWA Hiroyuki wrote:
> > > On Thu, 23 Jun 2011 09:41:33 +0200
> > > Michal Hocko <mhocko@xxxxxxx> wrote:
> > [...]
> > > > Other than that:
> > > > Reviewed-by: Michal Hocko <mhocko@xxxxxxx>
> > > >
> > >
> > > I found the page is added to LRU before charging. (In this case,
> > > memcg's LRU is ignored.) I'll post a new version with a fix.
> > Yes, you are right. I have missed that.
> > This means that we might race with reclaim which could evict the COWed
> > page wich in turn would uncharge that page even though we haven't
> > charged it yet.
> > Can we postpone page_add_new_anon_rmap to the charging path or it would
> > just race somewhere else?
> I got a different idea. How about this ?
> I think this will have benefit for non-memcg users under OOM, too.
Could you be more specific? I do not see how preallocation which might
turn out to be pointless could help under OOM.
> A concerns is VM_FAULT_RETRY case but wait-for-lock will be much heavier
> than preallocation + free-for-retry cost.
Preallocation is rather costly when fault handler fails (e.g. SIGBUS
which is the easiest one to trigger).
I am not saying this approach is bad but I think that preallocation can
be much more costly than unlock, charge and lock&recheck approach.
SUSE LINUX s.r.o.
190 00 Praha 9
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/