From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757888AbcDHHsB (ORCPT ); Fri, 8 Apr 2016 03:48:01 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:40315 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757159AbcDHHsA (ORCPT ); Fri, 8 Apr 2016 03:48:00 -0400 Date: Fri, 8 Apr 2016 09:47:44 +0200 From: Peter Zijlstra To: Pan Xinhui Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Boqun Feng , Thomas Gleixner Subject: Re: [PATCH] powerpc: introduce {cmp}xchg for u8 and u16 Message-ID: <20160408074744.GU3430@twins.programming.kicks-ass.net> References: <570752AA.9050603@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <570752AA.9050603@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 08, 2016 at 02:41:46PM +0800, Pan Xinhui wrote: > From: pan xinhui > > Implement xchg{u8,u16}{local,relaxed}, and > cmpxchg{u8,u16}{,local,acquire,relaxed}. > > Atomic operation on 8-bit and 16-bit data type is supported from power7 And yes I see nothing P7 specific here, this implementation is for everything PPC64 afaict, no? Also, note that you don't need explicit 8/16 bit atomics to implement these. Its fine to use 32bit atomics and only modify half the word. Also, you might want to invest in some CPP to reduce the endless repetition. Other than that, no objections :-)