Thread (52 messages) 52 messages, 5 authors, 2012-08-24

Re: [PATCH v8 1/5] mm: introduce a common interface for balloon pages mobility

From: Rafael Aquini <hidden>
Date: 2012-08-21 18:22:40
Also in: lkml

On Tue, Aug 21, 2012 at 06:41:42PM +0300, Michael S. Tsirkin wrote:
On Tue, Aug 21, 2012 at 05:16:06PM +0200, Peter Zijlstra wrote:
quoted
On Tue, 2012-08-21 at 16:52 +0300, Michael S. Tsirkin wrote:
quoted
quoted
+             rcu_read_lock();
+             mapping = rcu_dereference(page->mapping);
+             if (mapping_balloon(mapping))
+                     ret = true;
+             rcu_read_unlock();
This looks suspicious: you drop rcu_read_unlock
so can't page switch from balloon to non balloon? 
RCU read lock is a non-exclusive lock, it cannot avoid anything like
that.
You are right, of course. So even keeping rcu_read_lock across both test
and operation won't be enough - you need to make this function return
the mapping and pass it to isolate_page/putback_page so that it is only
dereferenced once.
No, I need to dereference page->mapping to check ->mapping flags here, before
returning. Remember this function is used at MM's compaction/migration inner
circles to identify ballooned pages and decide what's the next step. This
function is doing the right thing, IMHO.

Also, looking at how compaction/migration work, we verify the only critical path
for this function is the page isolation step. The other steps (migration and
putback) perform their work on private lists previouly isolated from a given
source.

So, we just need to make sure that the isolation part does not screw things up
by isolating pages that balloon driver is about to release. That's why there are
so many checkpoints down the page isolation path assuring we really are
isolating a balloon page. 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help