linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A . Shutemov" <kirill@shutemov.name>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [PATCH] mm: page_mkclean vs MADV_DONTNEED race
Date: Fri, 22 Mar 2019 13:53:42 +0530	[thread overview]
Message-ID: <8736nf8ghd.fsf@linux.ibm.com> (raw)
In-Reply-To: <20190321163147.cc2ff090a7388cdb7030eed0@linux-foundation.org>

Andrew Morton <akpm@linux-foundation.org> writes:

> On Thu, 21 Mar 2019 09:36:10 +0530 "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> wrote:
>
>> MADV_DONTNEED is handled with mmap_sem taken in read mode.
>> We call page_mkclean without holding mmap_sem.
>> 
>> MADV_DONTNEED implies that pages in the region are unmapped and subsequent
>> access to the pages in that range is handled as a new page fault.
>> This implies that if we don't have parallel access to the region when
>> MADV_DONTNEED is run we expect those range to be unallocated.
>> 
>> w.r.t page_mkclean we need to make sure that we don't break the MADV_DONTNEED
>> semantics. MADV_DONTNEED check for pmd_none without holding pmd_lock.
>> This implies we skip the pmd if we temporarily mark pmd none. Avoid doing
>> that while marking the page clean.
>> 
>> Keep the sequence same for dax too even though we don't support MADV_DONTNEED
>> for dax mapping
>
> What were the runtime effects of the bug?

The bug was noticed by code review and I didn't observe any failures
w.r.t test run. This is similar to 

commit 58ceeb6bec86d9140f9d91d71a710e963523d063
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date:   Thu Apr 13 14:56:26 2017 -0700

    thp: fix MADV_DONTNEED vs. MADV_FREE race
    
commit ced108037c2aa542b3ed8b7afd1576064ad1362a
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date:   Thu Apr 13 14:56:20 2017 -0700

    thp: fix MADV_DONTNEED vs. numa balancing race
    
>
> Did you consider a -stable backport?

Considering nobody reported issues w.r.t MADV_DONTNEED I was not sure.

-aneesh


      reply	other threads:[~2019-03-22  8:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21  4:06 [PATCH] mm: page_mkclean vs MADV_DONTNEED race Aneesh Kumar K.V
2019-03-21 23:31 ` Andrew Morton
2019-03-22  8:23   ` Aneesh Kumar K.V [this message]

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=8736nf8ghd.fsf@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).