Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157337

Re: [PATCH] compaction: fix isolate_migratepages_block() for THP=n

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: [PATCH] compaction: fix isolate_migratepages_block() for THP=n
Date Wed, 03 Jun 2015 13:30:02 +0200
Message-ID <pxf1U-7Sy-21@gated-at.bofh.it> (permalink)
References <pjPoB-3w7-7@gated-at.bofh.it> <pkm1b-1yE-9@gated-at.bofh.it> <pkmaT-1Ke-19@gated-at.bofh.it> <pkmky-1W3-11@gated-at.bofh.it> <pkmue-289-15@gated-at.bofh.it> <pxd05-4VX-3@gated-at.bofh.it>
X-Original-To Vlastimil Babka <vbabka@suse.cz>
Dkim-Signature v=1; a=rsa-sha256; c=simple/simple; d=shutemov.name; s=default; t=1433330664; bh=6w6NsY4JHD4VmBwGd3hUY7g6D6MQmYcfAp+9g21+a/A=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=f300tMqhFl7cec0VMVobrKmr9E+XIEk13hGxh5WnOnKaGuiqC5/xWsJ7HEsPYJrD7 Opx+UAYwXMrgJZrJhXo2rIILbcORindJomXEBGRWhHC9j+NPqPuiYHYNk7arDF1ksk hff5PsKBC2vCCqe85fE/7lIn5u4jWkhr97rtZCz4=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23.1 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 111
Organization linux.* mail to news gateway
X-Original-Cc Andrew Morton <akpm@linux-foundation.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sasha Levin <sasha.levin@oracle.com>
X-Original-Date Wed, 3 Jun 2015 14:24:24 +0300
X-Original-Message-ID <20150603112424.GA25259@node.dhcp.inet.fi>
X-Original-References <1430134006-215317-1-git-send-email-kirill.shutemov@linux.intel.com> <20150428151420.227e7ac34745e9fe8e9bc145@linux-foundation.org> <20150428222828.GA6072@node.dhcp.inet.fi> <20150428153724.cbe99bef1e7c2f073755539a@linux-foundation.org> <20150428224442.GA6188@node.dhcp.inet.fi> <556EC55D.40105@suse.cz>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1157337

Show key headers only | View raw


On Wed, Jun 03, 2015 at 11:14:05AM +0200, Vlastimil Babka wrote:
> On 04/29/2015 12:44 AM, Kirill A. Shutemov wrote:
> >>>
> >>> I wrote this to fix bug I originally attributed to refcounting patchset,
> >>> but Sasha triggered the same bug on -next without the patchset applied:
> >>>
> >>> http://lkml.kernel.org/g/553EB993.7030401@oracle.com
> >>
> >> Well why the heck didn't the changelog tell us this?!?!?
> > 
> > Sasha reported bug in -next after I sent the patch.
> > 
> >>
> >>> Now I think it's related to changing of PageLRU() behaviour on tail page
> >>> by my page flags patchset.
> >>
> >> So this patch is a bugfix against one of
> >>
> >> page-flags-trivial-cleanup-for-pagetrans-helpers.patch
> >> page-flags-introduce-page-flags-policies-wrt-compound-pages.patch
> >> page-flags-define-pg_locked-behavior-on-compound-pages.patch
> >> page-flags-define-behavior-of-fs-io-related-flags-on-compound-pages.patch
> >> page-flags-define-behavior-of-lru-related-flags-on-compound-pages.patch
> > 
> > ^^^ this one is fault, I think.
> 
> So this patch is now:
> http://www.ozlabs.org/~akpm/mmotm/broken-out/page-flags-define-behavior-of-lru-related-flags-on-compound-pages-fix.patch
> 
> I've found a non-fatal but misleading issues.
> 
> First, the "will fail to detect hugetlb pages in this case" part of the
> changelog, and mention of hugetlbfs in the comment is AFAIK moot.
> There's a PageLRU() check preceding the compound check, so hugetlbfs
> pages (which are not PageLRU() AFAIK) are already skipped at that point.
> I want to improve that in another series, but that's out of scope here.
> 
> Second, compound_order(page) returns 0 for a tail page, so the ALIGN()
> trick that's supposed to properly advance pfn from a tail page is
> useless. We could grab a head page, but stumbling on a THP tail page
> should be very rare so it's not worth the trouble - just remove the ALIGN.
> 
> From: Vlastimil Babka <vbabka@suse.cz>
> Date: Wed, 3 Jun 2015 11:03:37 +0200
> Subject: [PATCH] page-flags-define-behavior-of-lru-related-flags-on-compound-pages-fix-fix
> 
> Mentioning hugetlbfs is misleading, because PageLRU() checks skip over hugetlb pages.
> The ALIGN() parts are useless, because compound_order(page) returns 0 for tail pages.

ACK.

> 
> ---
>  mm/compaction.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 6ef2fdf..16e1b57 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -733,9 +733,12 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  		 * if PageLRU is set) but the lock is not necessarily taken
>  		 * here and it is wasteful to take it just to check transhuge.
>  		 * Check PageCompound without lock and skip the whole pageblock
> -		 * if it's either a transhuge or hugetlbfs page, as calling
> -		 * compound_order() without preventing THP from splitting the
> -		 * page underneath us may return surprising results.
> +		 * if it's a transhuge page, as calling compound_order()
> +		 * without preventing THP from splitting the page underneath us
> +		 * may return surprising results.
> +		 * If we happen to check a THP tail page, compound_order()
> +		 * returns 0. It should be rare enough to not bother with
> +		 * using compound_head() in that case.
>  		 */
>  		if (PageCompound(page)) {
>  			int nr;
> @@ -743,7 +746,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  				nr = 1 << compound_order(page);
>  			else
>  				nr = pageblock_nr_pages;
> -			low_pfn = ALIGN(low_pfn + 1, nr) - 1;
> +			low_pfn += nr - 1;
>  			continue;
>  		}
>  
> @@ -768,7 +771,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  				continue;
>  			if (PageCompound(page)) {
>  				int nr = 1 << compound_order(page);
> -				low_pfn = ALIGN(low_pfn + 1, nr) - 1;
> +				low_pfn += nr - 1;
>  				continue;
>  			}
>  		}
> -- 
> 2.1.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
 Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] compaction: fix isolate_migratepages_block() for THP=n "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-06-03 13:30 +0200

csiph-web