From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934088AbcLIR1C (ORCPT ); Fri, 9 Dec 2016 12:27:02 -0500 Received: from outbound-smtp04.blacknight.com ([81.17.249.35]:54715 "EHLO outbound-smtp04.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932989AbcLIR1B (ORCPT ); Fri, 9 Dec 2016 12:27:01 -0500 Date: Fri, 9 Dec 2016 17:26:58 +0000 From: Mel Gorman To: Vlastimil Babka Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim , Michal Hocko , "Kirill A. Shutemov" , Johannes Weiner Subject: Re: [PATCH 1/2] mm, page_alloc: don't convert pfn to idx when merging Message-ID: <20161209172658.uebsgt5ju6gtz2bu@techsingularity.net> References: <20161209093754.3515-1-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20161209093754.3515-1-vbabka@suse.cz> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 09, 2016 at 10:37:53AM +0100, Vlastimil Babka wrote: > In __free_one_page() we do the buddy merging arithmetics on "page/buddy index", > which is just the lower MAX_ORDER bits of pfn. The operations we do that affect > the higher bits are bitwise AND and subtraction (in that order), where the > final result will be the same with the higher bits left unmasked, as long as > these bits are equal for both buddies - which must be true by the definition of > a buddy. Ok, other than the kbuild warning, both patchs look ok. I expect the benefit is marginal but every little bit helps. > > We can therefore use pfn's directly instead of "index" and skip the zeroing of > >MAX_ORDER bits. This can help a bit by itself, although compiler might be > smart enough already. It also helps the next patch to avoid page_to_pfn() for > memory hole checks. > I expect this benefit only applies to a few archiectures and won't be visible on x86 but it still makes sense so for both patches; Acked-by: Mel Gorman As a slight aside, I recently spotted that one of the largest overhead in the bulk free path was in the page_is_buddy() checks so pretty much anything that helps that is welcome. -- Mel Gorman SUSE Labs