linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mauricio Faria de Oliveira <mfo@canonical.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Minchan Kim <minchan@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  linux-block@vger.kernel.org,
	Miaohe Lin <linmiaohe@huawei.com>
Subject: Re: [PATCH] mm: fix race between MADV_FREE reclaim and blkdev direct IO read
Date: Tue, 4 Jan 2022 08:49:32 -0300	[thread overview]
Message-ID: <CAO9xwp0buKKqEU=CLe0tjDhSM_NWx6aafXiNX3zPghNdtcPQyA@mail.gmail.com> (raw)
In-Reply-To: <871r2ct207.fsf@yhuang6-desk2.ccr.corp.intel.com>

On Thu, Dec 16, 2021 at 11:10 PM Huang, Ying <ying.huang@intel.com> wrote:
>
> Minchan Kim <minchan@kernel.org> writes:
...
> >
> > A madv_free marked page could be mapped at several processes so
> > it wouldn't be refcount two all the time, I think.
> > Shouldn't we check it with page_mapcount with page_refcount?
> >
> >     page_ref_count(page) - 1  > page_mapcount(page)
> >
>
> And should we consider page_count() too in madvise_free_pte_range()?
> That is, if the page has been used by GUP, we needn't to make its PTE
> clean?

Hey, thanks for reviewing!

That might not be sufficient time-wise, I guess, because the page can
be used by GUP after the madvise() call (e.g., this case), thus
checking for it during the call wouldn't catch it -- this may apply to
other cases too, where there's no guarantee/ordering between both
operations.

cheers,

-- 
Mauricio Faria de Oliveira


  reply	other threads:[~2022-01-04 11:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-11  2:21 Mauricio Faria de Oliveira
2021-12-16 18:17 ` Minchan Kim
2021-12-17  2:10   ` Huang, Ying
2022-01-04 11:49     ` Mauricio Faria de Oliveira [this message]
2022-01-04 11:46   ` Mauricio Faria de Oliveira
2022-01-04 23:06     ` Minchan Kim
2022-01-04 23:32       ` Mauricio Faria de Oliveira
2021-12-17 18:51 ` Yang Shi
2022-01-04 11:57   ` Mauricio Faria de Oliveira
2022-01-05  0:32   ` Huang, Ying
2022-01-05  1:20     ` Yang Shi
2022-01-05  1:42       ` Huang, Ying
2022-01-05  2:16         ` Yang Shi

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='CAO9xwp0buKKqEU=CLe0tjDhSM_NWx6aafXiNX3zPghNdtcPQyA@mail.gmail.com' \
    --to=mfo@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ying.huang@intel.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