Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp785232imm; Wed, 23 May 2018 05:37:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrzvaR/ibjsmmhSuyZp+Tj9BwtyW6ZsvyZ1IgI+s26poCvw0ukslMrFu8WM28iRu2WQvVKH X-Received: by 2002:a62:2218:: with SMTP id i24-v6mr2736833pfi.53.1527079028374; Wed, 23 May 2018 05:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527079028; cv=none; d=google.com; s=arc-20160816; b=CcqExU3O5eifMp1tKLRUjawV1FhFMh6ymi68/B2LyfzA4sOhmdTaraPoTHfkB+Q9m5 T4CgRxAhqIxVnTg/DIJwyldV1Q4Z+NJgX0zoV/voU6XEh15lAfWc+gShFgf0Mu4M7vDI 6UujWj0Rz8TJCGUeFjW2RBWBWqiDbrh4WZS8xgy0OmFYGfcsSgi/dnrN+PgSUSC+8YtP zYUc986xWTvdPP9bC+yNQvWzu8vrpv7NaEAdqOw5P25RbJcybDhCOZO9jz8TtTBZ9qtw oPU0Y3OiI8Z+idFbGk+skns0tHTWJ5nVdVSYo8juD9tLWpWYgx/yl5dD7EK2kFcJ5p68 QfSQ== 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=Y45pUBfQR0bSAdft6I/c8y52yHRU17yX6VmItD+npwU=; b=ZqWVQOFq/iiA+WhHq0NUHCS23C0l3YpGyGTWkPhNLQ7FwGhhfgNBCot9vK67lFoegx 9SMuLnPcqcZC61TU8Ah6Dh+WP5OWZe0Zb1XolbLLUibCFz7Fgl14F3x4EKP4WPhKHAhA NtrdNLCbDFfyxPe9ClIbm9XCp0ZbPhxpYJL8hcWhAtV8VgmVBD7zh7LtPZ7SQZcjxSSe oFnpwDaIAVrwj1WneTUiFZRIUs4gtaCNaRnq8GAX8jvrr99kXigNt+Q3HGpkdGWh+DOC JecTRLcBUbTXJK4fikCQVFW5L6o84M8JsFz30C63uQ9PWI7FfLoAKVyxyVv82ULQqujA hnDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=T3NHdYAs; 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 e9-v6si19265220plk.61.2018.05.23.05.36.35; Wed, 23 May 2018 05:37:08 -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=merlin.20170209 header.b=T3NHdYAs; 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 S932646AbeEWMgX (ORCPT + 99 others); Wed, 23 May 2018 08:36:23 -0400 Received: from merlin.infradead.org ([205.233.59.134]:41558 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932070AbeEWMgW (ORCPT ); Wed, 23 May 2018 08:36:22 -0400 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: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=Y45pUBfQR0bSAdft6I/c8y52yHRU17yX6VmItD+npwU=; b=T3NHdYAsqsVd7fgARM0D0hO/B YhtIXy+Nj6NFLeyArq4bYXj/WwV9kmE8MPi7n5tBHJqPhoGCNvhwK8FLbFwJPU03QltgQMZctCHVD Pw1DTc2hQa1FcXCQP9Fl6zwiW4XN+MGSm1dPwdR6vxHeEQpmSVjYAzAJ1oSv98klbUOn2FlqR/9/b +qpDrqzrBekUZWz5fomGZxJFDRGk4C+Pr+sVzX8gEIpIR9kafwvjUB08TmiyDHK0jelJk2F1BsBwn G/ihO64tjUOzupcxpUrGjdUU7hM3rDclU/F39YldAlv9ndPesEbHYCTtUW4y0SoflKhBlb0StL/+O +9LP0lShQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLT05-0002xO-MM; Wed, 23 May 2018 12:36:18 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3FC382029F1C1; Wed, 23 May 2018 14:36:15 +0200 (CEST) Date: Wed, 23 May 2018 14:36:15 +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: <20180523123615.GY12217@hirez.programming.kicks-ass.net> References: <20180509193645.830-1-bigeasy@linutronix.de> <20180509193645.830-4-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180509193645.830-4-bigeasy@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 > 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.