linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Josef Bacik <josef@toxicpanda.com>,
	linux-mm@kvack.org, Matthew Wilcox <willy@infradead.org>,
	 Chris Mason <clm@fb.com>
Subject: Re: [PATCH] mm: fix page leak with multiple threads mapping the same page
Date: Fri, 15 Jul 2022 11:21:32 -0400	[thread overview]
Message-ID: <c6109cfc1e7f1f3ed75ab6d17c1919619b23fd20.camel@surriel.com> (raw)
In-Reply-To: <20220707175803.3c30c6ea64843f4bd8b64908@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]

On Thu, 2022-07-07 at 17:58 -0700, Andrew Morton wrote:
> On Wed, 06 Jul 2022 20:42:56 -0400 Rik van Riel <riel@surriel.com>
> wrote:
> > > 
> > The explanation is that by the time we get to
> > finish_fault, we already have a reference on a
> > page, and we need to ensure that reference
> > gets released by the caller.
> > 
> > VM_FAULT_NOPAGE is one of the ways to indicate
> > that the page should be freed.
> 
> I think Kirill meant this should be added to the code comment!

OK, I finally got around to looking at that today, and
it seems like the comment at the top of finish_fault()
already has everything I wanted to write down. Is there
anything else we should add here?

/**
 * finish_fault - finish page fault once we have prepared the page to
fault
 *
 * @vmf: structure describing the fault
 *
 * This function handles all that is needed to finish a page fault once
the
 * page to fault in is prepared. It handles locking of PTEs, inserts
PTE for
 * given page, adds reverse page mapping, handles memcg charges and LRU
 * addition.
 *
 * The function expects the page to be locked and on success it
consumes a
 * reference of a page being mapped (for the PTE which maps it).
 *
 * Return: %0 on success, %VM_FAULT_ code in case of error.
 */
vm_fault_t finish_fault(struct vm_fault *vmf)
{



-- 
All Rights Reversed.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2022-07-15 15:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 20:00 Josef Bacik
2022-07-06 22:46 ` Kirill A. Shutemov
2022-07-07  0:42   ` Rik van Riel
2022-07-08  0:58     ` Andrew Morton
2022-07-15 15:21       ` Rik van Riel [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=c6109cfc1e7f1f3ed75ab6d17c1919619b23fd20.camel@surriel.com \
    --to=riel@surriel.com \
    --cc=akpm@linux-foundation.org \
    --cc=clm@fb.com \
    --cc=josef@toxicpanda.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --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