Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp805065imm; Wed, 23 May 2018 05:57:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrQgeBaojj5Nt5oEq7a2s0lyy89YROaMAIg0GIImC5POKz0pW8xOszKvHrhZSH/vYw5A76H X-Received: by 2002:a63:3d09:: with SMTP id k9-v6mr2334400pga.142.1527080226160; Wed, 23 May 2018 05:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527080226; cv=none; d=google.com; s=arc-20160816; b=L2SV7IWwwE+n3j6MvzKDJ/+fZ+NFCnKbV+FEqI7DOlBbs6SfhEZl5X6mAyPsTS/jml 1zFYsp8+R2wtwLbVp6hUINKiASQNvGWf63su8d1u1qB6mbRtk1izS1vFh1bUhTTiVLu+ jK69+XXMY6IJK58WLHngC7eukun9jFN72deUbttkzr1LKHTc6wPCIKTUq0Wa26JWcNZ0 6bbo0ZUyucYWn7FIdV33zu6gDc7Gs94IooblXeSdjlOVQ4Q3Ir4sw4Yul5wfvMbhBKlK bkddfYh6NKzzAOPCawq5fQvFhlNQs2lIf4THpgx4+yV5JrmWffrjnBOZXZUH2SLu3xJd sdRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=eEZUTCFPbzox84Afd9XCjJZ+0vt/nKhfL/pggfhKoA4=; b=UdxU3uj1jPjtsfS26INfKFL76L82JmEWQGaykaaaX4i8RsEdzW7KL7lc0GmHAb3tiE Hlnf7otrLu/5TOwafjuDAZOuLJotUdLkOnSNhq2ub85qKEAV4tp3gELn6SM3vfGAr1d+ YTLzp2QwhE+dC7hlMvbx+U4uxLEJ5IZBXsaUMNHbyXHgBpWoUt4z8RAyTNbM6GCD+BqK ad9/ZcKuu88ETnhXoZQFeONPJNxfV3y2GDRNb7sA41P6r2I2Zs/ytpIybz4bRHXqsa4D mmz9LeAEgLdAzDK7SEsojAMhOteThx4Q7KpHKvKmWPx8pv6uyBDMOVkftvDHp/DM2DNC hQRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=fe2VyE0X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16-v6si14164034pgc.427.2018.05.23.05.56.51; Wed, 23 May 2018 05:57:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=fe2VyE0X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932974AbeEWMzy (ORCPT + 99 others); Wed, 23 May 2018 08:55:54 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50718 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932865AbeEWMzw (ORCPT ); Wed, 23 May 2018 08:55:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eEZUTCFPbzox84Afd9XCjJZ+0vt/nKhfL/pggfhKoA4=; b=fe2VyE0X9oQLiTz0tgX0h4eyB 9/nYeByf1r/U89dfmBM1mQ2jLr+gEtCdKa4MKk6f8QJ1y5PQsaM4otuOxr9yRlTEelN3ISoDiradV tVykBXud9MiR7eynarsmdhzbrJMn8IsnSzpufGPE1Jswy083gcihpiCYgpXjIVRt6+y0sY48BN0AF TUZsxUVvtkK/dHXrO9gUjJ7M/W8h5DEzN3V6JA9p7/YW3U7x3DdnXLw6irNo/94+NVtLcbbAnPAdh SKiKY8a6EEMoiTqBFybSpGGgyxd9h210SKT16hz3u+79imNuy9CfV3lGJnvkfHfDnz3SrwhGR3JVa Z/EbFaeaQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLTIu-0001z4-Ic; Wed, 23 May 2018 12:55:44 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C1BE92029F1C0; Wed, 23 May 2018 14:55:42 +0200 (CEST) Date: Wed, 23 May 2018 14:55:42 +0200 From: Peter Zijlstra To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, Ingo Molnar , linux-mm@kvack.org, Shaohua Li , linux-raid@vger.kernel.org, Anna-Maria Gleixner Subject: Re: [PATCH 3/8] md: raid5: use refcount_t for reference counting instead atomic_t Message-ID: <20180523125542.GT12198@hirez.programming.kicks-ass.net> References: <20180509193645.830-1-bigeasy@linutronix.de> <20180509193645.830-4-bigeasy@linutronix.de> <20180523123615.GY12217@hirez.programming.kicks-ass.net> <20180523125007.pbxcxef622cde3jz@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180523125007.pbxcxef622cde3jz@linutronix.de> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 23, 2018 at 02:50:07PM +0200, Sebastian Andrzej Siewior wrote: > On 2018-05-23 14:36:15 [+0200], Peter Zijlstra wrote: > > > Most changes are 1:1 replacements except for > > > BUG_ON(atomic_inc_return(&sh->count) != 1); > > > > That doesn't look right, 'inc_return == 1' implies inc-from-zero, which > > is not allowed by refcount. > > > > > which has been turned into > > > refcount_inc(&sh->count); > > > BUG_ON(refcount_read(&sh->count) != 1); > > > > And that is racy, you can have additional increments in between. > > so do we stay with the atomic* API here or do we extend refcount* API? Stay with the atomic; I'll look at the rest of these patches, but raid5 looks like a usage-count, not a reference count. I'll probably ack your initial set and parts of this.. but let me get to the end of this first.