lkml.org 
[lkml]   [2016]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 23/28] mm, page_alloc: Check multiple page fields with a single branch
From
Date
On 04/15/2016 11:07 AM, Mel Gorman wrote:
> Every page allocated or freed is checked for sanity to avoid corruptions
> that are difficult to detect later. A bad page could be due to a number of
> fields. Instead of using multiple branches, this patch combines multiple
> fields into a single branch. A detailed check is only necessary if that
> check fails.
>
> 4.6.0-rc2 4.6.0-rc2
> initonce-v1r20 multcheck-v1r20
> Min alloc-odr0-1 359.00 ( 0.00%) 348.00 ( 3.06%)
> Min alloc-odr0-2 260.00 ( 0.00%) 254.00 ( 2.31%)
> Min alloc-odr0-4 214.00 ( 0.00%) 213.00 ( 0.47%)
> Min alloc-odr0-8 186.00 ( 0.00%) 186.00 ( 0.00%)
> Min alloc-odr0-16 173.00 ( 0.00%) 173.00 ( 0.00%)
> Min alloc-odr0-32 165.00 ( 0.00%) 166.00 ( -0.61%)
> Min alloc-odr0-64 162.00 ( 0.00%) 162.00 ( 0.00%)
> Min alloc-odr0-128 161.00 ( 0.00%) 160.00 ( 0.62%)
> Min alloc-odr0-256 170.00 ( 0.00%) 169.00 ( 0.59%)
> Min alloc-odr0-512 181.00 ( 0.00%) 180.00 ( 0.55%)
> Min alloc-odr0-1024 190.00 ( 0.00%) 188.00 ( 1.05%)
> Min alloc-odr0-2048 196.00 ( 0.00%) 194.00 ( 1.02%)
> Min alloc-odr0-4096 202.00 ( 0.00%) 199.00 ( 1.49%)
> Min alloc-odr0-8192 205.00 ( 0.00%) 202.00 ( 1.46%)
> Min alloc-odr0-16384 205.00 ( 0.00%) 203.00 ( 0.98%)
>
> Again, the benefit is marginal but avoiding excessive branches is
> important. Ideally the paths would not have to check these conditions at
> all but regrettably abandoning the tests would make use-after-free bugs
> much harder to detect.
>
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

I wonder, would it be just too ugly to add +1 to atomic_read(&page->_mapcount)
and OR it with the rest for a truly single branch?

\
 
 \ /
  Last update: 2016-04-26 21:01    [W:0.256 / U:0.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site