Thread (17 messages) 17 messages, 6 authors, 2012-01-26
STALE5273d

[PATCH] mm: preallocate page before lock_page at filemap COW. (WasRe: [PATCH V2] mm: Do not keep page locked during page fault while charging it for memcg

From: KAMEZAWA Hiroyuki <hidden>
Date: 2011-06-23 10:09:14
Also in: lkml
Subsystem: memory management, memory management - core, the rest · Maintainers: Andrew Morton, David Hildenbrand, Linus Torvalds

On Thu, 23 Jun 2011 11:02:04 +0200
Michal Hocko [off-list ref] wrote:
On Thu 23-06-11 17:08:11, KAMEZAWA Hiroyuki wrote:
quoted
On Thu, 23 Jun 2011 09:41:33 +0200
Michal Hocko [off-list ref] wrote:
[...]
quoted
quoted
Other than that:
Reviewed-by: Michal Hocko <redacted>
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.

A concerns is VM_FAULT_RETRY case but wait-for-lock will be much heavier
than preallocation + free-for-retry cost.

(I'm sorry I'll not be very active until the next week, so feel free to
 post your own version if necessary.)

This is onto -rc4 and worked well on my test.

==
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help