linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Jan Kara <jack@suse.cz>, Andrea Arcangeli <aarcange@redhat.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Matthew Wilcox <willy@infradead.org>,
	Vratislav Bendel <vbendel@redhat.com>,
	Rafael Aquini <aquini@redhat.com>
Subject: Re: [PATCH RFC] mm: migrate: don't rely on PageMovable() of newpage after unlocking it
Date: Mon, 28 Jan 2019 14:22:52 +0100	[thread overview]
Message-ID: <17e7d7e4-f4ca-a681-93e5-92a0c285be14@redhat.com> (raw)
In-Reply-To: <20190128132146.GK18811@dhcp22.suse.cz>

On 28.01.19 14:21, Michal Hocko wrote:
> On Mon 28-01-19 14:14:28, David Hildenbrand wrote:
>> On 28.01.19 14:07, Michal Hocko wrote:
>>> On Mon 28-01-19 13:16:09, David Hildenbrand wrote:
>>> [...]
>>>> My theory:
>>>>
>>>> In __unmap_and_move(), we lock the old and newpage and perform the
>>>> migration. In case of vitio-balloon, the new page will become
>>>> movable, the old page will no longer be movable.
>>>>
>>>> However, after unlocking newpage, I think there is nothing stopping
>>>> the newpage from getting dequeued and freed by virtio-balloon. This
>>>> will result in the newpage
>>>> 1. No longer having PageMovable()
>>>> 2. Getting moved to the local list before finally freeing it (using
>>>>    page->lru)
>>>
>>> Does that mean that the virtio-balloon can change the Movable state
>>> while there are other users of the page? Can you point to the code that
>>> does it? How come this can be safe at all? Or is the PageMovable stable
>>> only under the page lock?
>>>
>>
>> PageMovable is stable under the lock. The relevant instructions are in
>>
>> mm/balloon_compaction.c and include/linux/balloon_compaction.h
> 
> OK, I have just checked __ClearPageMovable and it indeed requires
> PageLock. Then we also have to move is_lru = __PageMovable(page) after
> the page lock.
> 

I assume that is fine as is as the page is isolated? (yes, it will be
modified later when moving but we are interested in the original state)

-- 

Thanks,

David / dhildenb

  reply	other threads:[~2019-01-28 13:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 12:16 [PATCH RFC] mm: migrate: don't rely on PageMovable() of newpage after unlocking it David Hildenbrand
2019-01-28 13:07 ` Michal Hocko
2019-01-28 13:14   ` David Hildenbrand
2019-01-28 13:21     ` Michal Hocko
2019-01-28 13:22       ` David Hildenbrand [this message]
2019-01-28 13:35         ` Michal Hocko
2019-01-28 14:38           ` David Hildenbrand
2019-01-28 14:53             ` Michal Hocko
2019-01-28 15:01             ` Rafael Aquini
2019-01-28 15:04               ` Rafael Aquini
2019-01-28 15:13                 ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17e7d7e4-f4ca-a681-93e5-92a0c285be14@redhat.com \
    --to=david@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aquini@redhat.com \
    --cc=jack@suse.cz \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@dominikbrodowski.net \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=vbendel@redhat.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).