From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B4E7C4332F for ; Sat, 5 Nov 2022 15:14:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82DCB6B0072; Sat, 5 Nov 2022 11:14:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B6956B0073; Sat, 5 Nov 2022 11:14:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 656C56B0074; Sat, 5 Nov 2022 11:14:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 52DE66B0072 for ; Sat, 5 Nov 2022 11:14:35 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 29AFE160C68 for ; Sat, 5 Nov 2022 15:14:35 +0000 (UTC) X-FDA: 80099735310.19.76ECD27 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 495F51C0003 for ; Sat, 5 Nov 2022 15:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Ekr6Ag+B1UJpoeicPPmJBxRvs9MjSDhSR1SM46lu9oA=; b=YUqkdhzPuj35LQ0nNTHFA1lrVd lxWzXxqhhIDwXpczLn5LEZceWYVlkhiZgdtoHk5rKZVZrN/d85dNKSe8YMVYdY9qUDiwXZr6bAj84 6jm3QKVzj5fkHWEtwWFBNVabQAJGPKjC40kSlyQnkfhHju3GqZIEH4vbNPzHIpfZXbukY4bGbgmMt c9C4pthYgjx7fo8+YNitrMIdNGlkwO+yJKL2tYB2Mc39TD9uG0YaiTihVGb97wt31a8u1kj6pOYRe IA8f1u1tk+2EGvQC0ZCiwR7561IXwZHSVBWgrsf4B9SFrhsA6jPaLVNOwTHab/t8MjD849pDgbh1m za019YGQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1orKsM-008GWE-O3; Sat, 05 Nov 2022 15:14:26 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E03C930007E; Sat, 5 Nov 2022 16:14:19 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BA99C209E95D6; Sat, 5 Nov 2022 16:14:19 +0100 (CET) Date: Sat, 5 Nov 2022 16:14:19 +0100 From: Peter Zijlstra To: "Jason A. Donenfeld" Cc: Linus Torvalds , Nathan Chancellor , Uros Bizjak , x86@kernel.org, willy@infradead.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, aarcange@redhat.com, kirill.shutemov@linux.intel.com, jroedel@suse.de Subject: Re: [PATCH 11/13] x86_64: Remove pointless set_64bit() usage Message-ID: References: <20221022111403.531902164@infradead.org> <20221022114425.168036718@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667661274; a=rsa-sha256; cv=none; b=HCg0fK8+T67kcf8X+KgI+u//m2sM0DS48MK9wlfLA4a0XwwYULnOqqLkYxH+eX1h4ZU9M5 KPK0fl4fhMxe3/uoDpgaoDhPj2DMS+gF3go+l2Hn+fc0eqgZjj0WX3a9n39wxdZ305E2Nz HCR1upEapKBTgfzNi9tIPqr3CRXEdds= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=YUqkdhzP; spf=none (imf21.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667661274; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Ekr6Ag+B1UJpoeicPPmJBxRvs9MjSDhSR1SM46lu9oA=; b=5UHM9jQLjh36APunVzP3/hTqWgLbieJX+GT7EXT+0cGcekfX5XaztaeAk7RSQgHrMUCtgZ 4dZBiE0BDnnSkrG0uT2/FHT4eoGMgjXP9OiI70I1W/lxxrJuQIo7EsAGrqgftjvxAXME5G 03cBcManw6HyRXOu0qDtzuEKsdHMIE4= X-Stat-Signature: urwaw51tfg7jwy9a8wmizp3d3y5dbk6a X-Rspamd-Server: rspam09 X-Rspam-User: X-Rspamd-Queue-Id: 495F51C0003 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=YUqkdhzP; spf=none (imf21.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none X-HE-Tag: 1667661273-372834 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Nov 05, 2022 at 02:29:47PM +0100, Jason A. Donenfeld wrote: > On Fri, Nov 04, 2022 at 10:15:08AM -0700, Linus Torvalds wrote: > > On Fri, Nov 4, 2022 at 9:01 AM Peter Zijlstra wrote: > > > > > > So cmpxchg_double() does a cmpxchg on a double long value and is > > > currently supported by: i386, x86_64, arm64 and s390. > > > > > > On all those, except i386, two longs are u128. > > > > > > So how about we introduce u128 and cmpxchg128 -- then it directly > > > mirrors the u64 and cmpxchg64 usage we already have. It then also > > > naturally imposses the alignment thing. > > > > Ack, except that we might have some "u128" users that do *not* > > necessarily want any alignment thing. > > > > But maybe we could at least start with an u128 type that is marked as > > being fully aligned, and if some other user comes in down the line > > that wants relaxed alignment we can call it "u128_unaligned" or > > something. > > Hm, sounds maybe not so nice for another use case: arithmetic code that > makes use of u128 for efficient computations, but otherwise has > no particular alignment requirements. For example, `typedef __uint128_t > u128;` in: Natural alignment is... natural. Making it unaligned is quite mad. That whole u64 is not naturally aligned on i386 thing Linus referred to is a sodding pain in the backside. If the code has no alignment requirements, natural alignment is as good as any. And if it does have requirements, you can use u128_unaligned. Also: $ ./align 16, 16 --- #include int main(int argx, char **argv) { __int128 a; printf("%d, %d\n", sizeof(a), __alignof(a)); return 0; }