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: <20160824153412.GA10153@twins.programming.kicks-ass.net>
Date:   Wed, 24 Aug 2016 17:34:12 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Will Deacon <will.deacon@....com>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Waiman Long <waiman.long@....com>,
        Jason Low <jason.low2@....com>,
        Ding Tianhong <dingtianhong@...wei.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Imre Deak <imre.deak@...el.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Davidlohr Bueso <dave@...olabs.net>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        Terry Rudd <terry.rudd@....com>,
        "Paul E. McKenney" <paulmck@...ibm.com>,
        Jason Low <jason.low2@...com>
Subject: Re: [RFC][PATCH 1/3] locking/mutex: Rework mutex::owner

On Wed, Aug 24, 2016 at 10:56:59AM +0100, Will Deacon wrote:
> > +	owner = atomic_long_read(&lock->owner);
> > +	for (;;) {
> > +		unsigned long old;
> > +
> > +		old = atomic_long_cmpxchg_release(&lock->owner, owner, owner & 0x03);
> > +		if (old == owner)
> > +			break;
> > +
> > +		owner = old;
> > +	}
> 
> Can you rewrite this using atomic_long_fetch_and_release?

Yes, until patch 3/3.. but now that you mention it I think we can do:

	owner = atomic_long_read(&lock->owner);
	if (!(owner & MUTEX_FLAG_HANDOFF))
		(void)atomic_long_fetch_and_release(MUTEX_FLAGS, &lock->owner);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ