From: "Zach O'Keefe" <zokeefe@google.com>
To: Yang Shi <shy828301@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 1/2] mm/MADV_COLLAPSE: set EAGAIN on unexpected page refcount
Date: Wed, 25 Jan 2023 11:15:34 -0800 [thread overview]
Message-ID: <CAAa6QmRL1H0VEhE0oA87=jyi4hL3v_T+XO7izfCtArnXcBP4DQ@mail.gmail.com> (raw)
In-Reply-To: <CAHbLzkoF+gbgopWBSP0Xe0+g-DLF_n-NQ_7gvg+0EEGpv8Q7Tw@mail.gmail.com>
On Wed, Jan 25, 2023 at 10:06 AM Yang Shi <shy828301@gmail.com> wrote:
>
> On Tue, Jan 24, 2023 at 5:58 PM Zach O'Keefe <zokeefe@google.com> wrote:
> >
> > During collapse, in a few places we check to see if a given small page
> > has any unaccounted references. If the refcount on the page doesn't
> > match our expectations, it must be there is an unknown user concurrently
> > interested in the page, and so it's not safe to move the contents
> > elsewhere. However, the unaccounted pins are likely an ephemeral state.
> >
> > In such a situation, make MADV_COLLAPSE set EAGAIN errno, indicating that
> > collapse may succeed on retry.
>
> The page may be DMA pinned (for example, pin_user_pages()), it is not
> worth retrying for such pages. But it may also not be worth optimizing
> for this case at this point.
>
> So the patch looks good to me. Reviewed-by: Yang Shi <shy828301@gmail.com>
Thanks as always, Yang, and good point about DMA pinning. As you
mentioned, I don't know if it's worth considering that too much right
now, as it's unlikely these two uses (MADV_COLLAPSE and DMA pining)
would be used together. We can revisit if necessary later if it's an
issue, but for now, I think it's a win that MADV_COLLAPSE (+ a bounded
userspace retry loop based off erno) is more likely to succeed.
next prev parent reply other threads:[~2023-01-25 19:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 1:57 Zach O'Keefe
2023-01-25 1:57 ` [PATCH 2/2] mm/MADV_COLLAPSE: catch !none !huge !bad pmd lookups Zach O'Keefe
2023-01-25 12:54 ` kernel test robot
2023-01-25 13:38 ` kernel test robot
2023-01-25 18:06 ` [PATCH 1/2] mm/MADV_COLLAPSE: set EAGAIN on unexpected page refcount Yang Shi
2023-01-25 19:15 ` Zach O'Keefe [this message]
2023-02-09 5:09 ` Hugh Dickins
2023-02-09 21:28 ` Andrew Morton
2023-02-09 21:50 ` Hugh Dickins
2023-02-09 22:12 ` Andrew Morton
2023-02-09 22:29 ` Zach O'Keefe
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='CAAa6QmRL1H0VEhE0oA87=jyi4hL3v_T+XO7izfCtArnXcBP4DQ@mail.gmail.com' \
--to=zokeefe@google.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
/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