Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1107726pxk; Fri, 18 Sep 2020 04:06:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNSrBBKLB+4r4n9BKt1GH44xWD8XOnQP933JYmFaEIW2JbidJ4FQUHxSVm8y35TO+m2aF4 X-Received: by 2002:a17:906:b813:: with SMTP id dv19mr34821141ejb.70.1600427191711; Fri, 18 Sep 2020 04:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600427191; cv=none; d=google.com; s=arc-20160816; b=sAuwshUPYmPOrWZdbn1WyRydImdzO7IQCwsWQoY0dT2RJfSfJDM9PFqftxtBcG9Gl2 Qb3FhwNbDGEtSltNPFxZaeV7tRdv5N5pml7I8e2p9WhmFEyco/YEycQxQwbdmgv5ok+C 74TCa2eYglAszYjKBcObmVpSYtgHID3Jm7U5iMRZNeTTPGePsU0ohyHrI4eR9HEDsQIW R5+j3aQ4Px9d16tiHxoVYbqzikFeu4W1BGdpM+OuPsYy5fH7a4l7suB0yAG84p5hwQ+M 2pNPpAEy/zP8Zy0DQe47OEsu9KWfmksXMdtL0APBa85EFQXeUe2UhRkVEXgxvNKhsoUa RuTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=92sFFvsbksd+Q+ekXiuYgLRc7bHpzXKtlRe7taGQ3R4=; b=IWegVNKPcx1ZdsyqKscPiHHnTB9pCgEVusL+fnM8hy3COcvPeLixdMru0f6hFyOfrT IT8HIlEM042iV/bmAjBZcpZCl+8/D1iEvxRz4gvnna57sgFIaKBCOkh0pgvKuqEPthOt WWokdG3QraZkAT4LYRVJokacrK9fqXE/sR1ORNoU+LD0A30SjRJYrPuQVLM44cb0dnJz PgiJgU7rnCU72UP/8Sng44SdzOD44OZwH00fUorwHjg2wyYpVV8p/3r3OmDrsYD/EigT zJM8EP2j1lEKt7wnrp5Cpxgn4CW7cMpOqNO2uDOoKVuaXMo6FQVymRBgytw9NbJ+xiEp ebcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=No0LQr9w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si1985284eje.544.2020.09.18.04.06.08; Fri, 18 Sep 2020 04:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=No0LQr9w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbgIRLDW (ORCPT + 99 others); Fri, 18 Sep 2020 07:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726390AbgIRLDW (ORCPT ); Fri, 18 Sep 2020 07:03:22 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE428C06174A; Fri, 18 Sep 2020 04:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=92sFFvsbksd+Q+ekXiuYgLRc7bHpzXKtlRe7taGQ3R4=; b=No0LQr9wd6VpEKjh9PeHsQSz46 08Zg0cPPnvi1h/4/oT3HEARgvxxWZFm4j8DbddK73E8n0zd3+z8A6fpLBSGRuoYrJeX55XUQDlTyE 4TF6MKskZ7lZNIdtQ30SAJcR1RPXuXSlfoppRQlIRH30xeodU01xNmPuz7EfFA8JAcQLlCCSYli3h b4TgzU5fr0S2IxmRXhgzE7qhefxLHtLFdMdn9Qyz0SrbUVt9xY7ZJWWPX4D9OdTaN2p7r+a9KKJgF CNUkbp90FFtct5VPoA0gazcQHFgQ/OG+wihno2BxPBOFwzKEAGme3/6T+jEEFV52dUY5wTHLihht/ SBEPipeA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJEAa-0008MB-4Y; Fri, 18 Sep 2020 11:03:12 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 680D93060F2; Fri, 18 Sep 2020 13:03:10 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4475720D4DC83; Fri, 18 Sep 2020 13:03:10 +0200 (CEST) Date: Fri, 18 Sep 2020 13:03:10 +0200 From: peterz@infradead.org To: Oleg Nesterov Cc: Jan Kara , Boaz Harrosh , Hou Tao , Ingo Molnar , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [RFC PATCH] locking/percpu-rwsem: use this_cpu_{inc|dec}() for read_count Message-ID: <20200918110310.GO1362448@hirez.programming.kicks-ass.net> References: <20200915153113.GA6881@redhat.com> <20200915155150.GD2674@hirez.programming.kicks-ass.net> <20200915160344.GH35926@hirez.programming.kicks-ass.net> <20200917120132.GA5602@redhat.com> <20200918090702.GB18920@quack2.suse.cz> <20200918100112.GN1362448@hirez.programming.kicks-ass.net> <20200918101216.GL35926@hirez.programming.kicks-ass.net> <20200918104824.GA23469@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200918104824.GA23469@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 18, 2020 at 12:48:24PM +0200, Oleg Nesterov wrote: > Of course, this assumes that atomic_t->counter underflows "correctly", just > like "unsigned int". We're documented that we do. Lots of code relies on that. See Documentation/atomic_t.txt TYPES > But again, do we really want this? I like the two counters better, avoids atomics entirely, some archs hare horridly expensive atomics (*cough* power *cough*). I just tried to be clever and use a single u64 load (where possible) instead of two 32bit loads and got the sum vs split order wrong.