lkml.org 
[lkml]   [2020]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] mm/page_alloc.c: Micro-optimisation Remove unnecessary branch
On Sat, Mar 07, 2020 at 03:15:42PM -0800, Andrew Morton wrote:
> On Sat, 7 Mar 2020 23:53:35 +0100 mateusznosek0@gmail.com wrote:
> > - if (unlikely(ac.nodemask != nodemask))
> > - ac.nodemask = nodemask;
> > + ac.nodemask = nodemask;
>
> This will now unconditionally dirty the ac.nodemask cacheline, which
> means that cacheline will need to be written back. If it is truly
> unlikely that the write was needed then the thinking goes that the
> test-and-branch is worthwhile, by saving on memory traffic.
>
> At least, I assume that's why the code is the way it is.

The line immediately before this hunk is:

ac.spread_dirty_pages = false;

ac is on-stack and is only 32 bytes. I don't see a reason not to do this.

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

\
 
 \ /
  Last update: 2020-03-08 12:50    [W:0.028 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site