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: <20180723140420.GY2458@hirez.programming.kicks-ass.net>
Date:   Mon, 23 Jul 2018 16:04:20 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc:     Ingo Molnar <mingo@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Rik van Riel <riel@...riel.com>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v2 13/19] mm/migrate: Use xchg instead of spinlock

On Mon, Jul 23, 2018 at 04:20:32AM -0700, Srikar Dronamraju wrote:
> > If you maybe write that like:
> > 
> > 	if (time_after(jiffies, next_window) &&
> > 	    xchg(&pgdat->numabalancing_migrate_nr_pages, 0UL)) {
> > 
> > 		do {
> > 			next_window += interval;
> > 		} while (unlikely(time_after(jiffies, next_window)));
> > 
> > 		WRITE_ONCE(pgdat->numabalancing_migrate_next_window, next_window);
> > 	}
> > 
> > Then you avoid an indent level and line-wrap, resulting imo easier to
> > read code.
> > 
> 
> Okay will do.

FWIW, that code seems to rely on @nr_pages != 0, otherwise you can have
the xchg fail even though time_after is true.

Probably not a problem, but it is a semantic change vs the spinlock.
Also, the spinlock thing could probably have changed to a trylock and
you'd have seens similar 'gains' I suppose.

Another difference vs the lock+unlock is that you lost the release
ordering. Again, probably not a big deal, but it does make the whole
things a little dodgy.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ