lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6f7ee3c-75ae-63a8-cde0-1d00e65cb973@suse.cz>
Date:   Fri, 9 Dec 2016 19:32:22 +0100
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Mel Gorman <mgorman@...hsingularity.net>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, Joonsoo Kim <iamjoonsoo.kim@....com>,
        Michal Hocko <mhocko@...nel.org>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Johannes Weiner <hannes@...xchg.org>
Subject: Re: [PATCH 1/2] mm, page_alloc: don't convert pfn to idx when merging

On 12/09/2016 06:26 PM, Mel Gorman wrote:
> 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 <mgorman@...hsingularity.net>

Thanks!

> 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.

Interesting, the function shouldn't be doing really much on x86 without
debug config options? We might try further optimize the zone equivalence
checks, perhaps?
- try caching page_zone_id(page) through whole merging, and only obtain
it freshly
  for buddy candidate
- mark arches/configurations sane enough that they have no zone boundary
within MAX_ORDER, and skip these checks there. I assume most, if not all
x86 would fall here? Somewhat analogically to page_valid_within().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ