[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wj-pfzKf3JDe9fr4o_nKYXJXfuYAMFCajwhy0YYYri4Fw@mail.gmail.com>
Date: Fri, 21 Aug 2020 10:00:59 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Jan Kara <jack@...e.cz>
Cc: Peter Xu <peterx@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Linux-MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Marty Mcfadden <mcfadden8@...l.gov>,
"Maya B . Gokhale" <gokhale2@...l.gov>,
Jann Horn <jannh@...gle.com>, Christoph Hellwig <hch@....de>,
Oleg Nesterov <oleg@...hat.com>,
Kirill Shutemov <kirill@...temov.name>
Subject: Re: [PATCH v3] mm/gup: Allow real explicit breaking of COW
On Fri, Aug 21, 2020 at 8:48 AM Jan Kara <jack@...e.cz> wrote:
>
> I was more concerned about the case where you decide to writeably map (i.e.
> wp_page_reuse() path) a PageKsm() page.
Yeah, so I think what I do is stricter than what we used to do - any
KSM page will never be re-used, simply because the KSM part will have
incremented the page count.
So as far as I can tell, with that patch we will never ever share
except for the "I really am the _only_ user of the page, there are no
KSM or swap cache pages" case.
That's the whole point of the patch. Get rid of all the games. If
there is *any* possible other use - be it KSM or swap cache or
*anything*, we don't try to re-use it.
> And also here I was more concerned that page_mapcount != 1 || page_count !=
> 1 check could be actually a weaker check than what reuse_swap_page() does.
If that is the case, then yes, that would be a problem.
But really, if page_count() == 1, then we're the only possible thing
that holds that page. Nothing else can have a reference to it - by
definition.
And if page_count() != 1, we will not share. Ever. We'll just do what
zap_paghe_range() does - unmap the old page and do the
page_remove_rmap().
The only small worry would be the race between releasing the page
table lock - when we allocate a new page - and somebody coming in and
doing something magical to that page. But that's where holding the
page lock comes in.
Plus that part isn't anything my patch changes.
Linus
Powered by blists - more mailing lists