linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Oscar Salvador <OSalvador@suse.com>,
	Pavel Tatashin <pasha.tatashin@oracle.com>,
	David Hildenbrand <david@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 3/3] mm, fault_around: do not take a reference to a locked page
Date: Tue, 20 Nov 2018 17:17:00 +0300	[thread overview]
Message-ID: <20181120141700.pwoaxatx3v5xnwos@kshutemo-mobl1> (raw)
In-Reply-To: <20181120141207.GK22247@dhcp22.suse.cz>

On Tue, Nov 20, 2018 at 03:12:07PM +0100, Michal Hocko wrote:
> On Tue 20-11-18 17:07:15, Kirill A. Shutemov wrote:
> > On Tue, Nov 20, 2018 at 02:43:23PM +0100, Michal Hocko wrote:
> > > From: Michal Hocko <mhocko@suse.com>
> > > 
> > > filemap_map_pages takes a speculative reference to each page in the
> > > range before it tries to lock that page. While this is correct it
> > > also can influence page migration which will bail out when seeing
> > > an elevated reference count. The faultaround code would bail on
> > > seeing a locked page so we can pro-actively check the PageLocked
> > > bit before page_cache_get_speculative and prevent from pointless
> > > reference count churn.
> > 
> > Looks fine to me.
> 
> Thanks for the review.
> 
> > But please drop a line of comment in the code. As is it might be confusing
> > for a reader.
> 
> This?

Yep.

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index c76d6a251770..7c4e439a2e85 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2554,6 +2554,10 @@ void filemap_map_pages(struct vm_fault *vmf,
>  
>  		head = compound_head(page);
>  
> +		/*
> +		 * Check the locked pages before taking a reference to not
> +		 * go in the way of migration.
> +		 */
>  		if (PageLocked(head))
>  			goto next;
>  		if (!page_cache_get_speculative(head))
> -- 
> Michal Hocko
> SUSE Labs

-- 
 Kirill A. Shutemov

  reply	other threads:[~2018-11-20 14:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 13:43 [RFC PATCH 0/3] few memory offlining enhancements Michal Hocko
2018-11-20 13:43 ` [RFC PATCH 1/3] mm, memory_hotplug: try to migrate full section worth of pages Michal Hocko
2018-11-20 14:18   ` David Hildenbrand
2018-11-20 14:25     ` Michal Hocko
2018-11-20 14:27       ` David Hildenbrand
2018-11-20 14:33   ` Pavel Tatashin
2018-11-20 14:51   ` osalvador
2018-11-20 15:00     ` Michal Hocko
2018-11-20 13:43 ` [RFC PATCH 2/3] mm, memory_hotplug: deobfuscate migration part of offlining Michal Hocko
2018-11-20 14:26   ` David Hildenbrand
2018-11-20 14:34     ` Michal Hocko
2018-11-20 14:34       ` David Hildenbrand
2018-11-20 15:13   ` osalvador
2018-11-20 15:18     ` Michal Hocko
2018-11-20 13:43 ` [RFC PATCH 3/3] mm, fault_around: do not take a reference to a locked page Michal Hocko
2018-11-20 14:07   ` Kirill A. Shutemov
2018-11-20 14:12     ` Michal Hocko
2018-11-20 14:17       ` Kirill A. Shutemov [this message]
2018-11-20 14:25         ` Michal Hocko
2018-11-21  4:51       ` William Kucharski
2018-11-21  7:07         ` Michal Hocko
2018-11-20 14:33   ` David Hildenbrand
2018-11-21  1:47   ` Hugh Dickins
2018-11-21  7:11     ` Michal Hocko
2018-11-22  2:27       ` Hugh Dickins
2018-11-22  9:05         ` Michal Hocko
2018-11-23 20:22           ` Hugh Dickins

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=20181120141700.pwoaxatx3v5xnwos@kshutemo-mobl1 \
    --to=kirill@shutemov.name \
    --cc=OSalvador@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=pasha.tatashin@oracle.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;
as well as URLs for NNTP newsgroup(s).