Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3290807pxk; Tue, 15 Sep 2020 15:32:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9iEks8kXNMwFh2uXvM33BGYzHq1P8TzL1Q0FhnE9s9Ws3m3O3HmCvoYbK2IJe7kHhXR3l X-Received: by 2002:aa7:da10:: with SMTP id r16mr25288653eds.333.1600209173698; Tue, 15 Sep 2020 15:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600209173; cv=none; d=google.com; s=arc-20160816; b=ea15/JFqauo6PvRRzOITcWqR/kpZ1ybEaJBgUHbUWvpdCf5ueg2GxGsNiIheWMuoWc CzQUkckZ/BmoPxoVcBXxXITKX4+0ng2EC3BsGr7Qu2eMxm51uhRHXYnf9mt0wf0ONVjV SnJf+Vbzn4aLXljjpznXfQ+96fjlHsLXX55tnni1DY6+t+LrIynLRj1xWr/mUMj1meIu evXRkVxPQAXDsN7zjWUCtQEfms+m+VKDrjHpMAovoAr2LElZ6EDvq4rQhp1EwMYejueN eRsqq0ol47aEnv/HIdIuNpObXdMFs1j0r5IE69gpKSRENmEEaapT31PMsiLsNypv6XRQ 7d1g== 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; bh=o/7/rnXQ8wAdRO0svnJz8X4slHDBpw2XQcdzYIwA/4E=; b=UXRasRp3kQOFx1d+/siZEka9ACzUlVSUQfP5jTnXDsN54Th1ZbdCOM1ZC0rQ2pQUeM jUY8Cxsvu27IVDSGhEgAskt8JhsXfV/oVYgyZ07g1Z74SrycKl6RIdqNRN70iR0YMAiT 2Zet0W0OUMFAGEmJr+9/4bKu+PumXWi01+FJQjOeMFc3/Ysie0Eq46/tCqpzHhQ5CXJ3 zsaoYMPP9yJLmN6EWBJSkU2iXaiYDDHQ6B9kURF6iizpLdlarWD/7n/qzoIdczu8DZgl bU1kZaFMnhH+/yP5ahBkhthXPz/Oe5iHweaWcoOZJX8ocq7diCRvQp3KJAqHflA1ElQj 1uCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1SbAjFts; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si10755537ejx.605.2020.09.15.15.32.31; Tue, 15 Sep 2020 15:32:53 -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=@kernel.org header.s=default header.b=1SbAjFts; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727618AbgIOWbs (ORCPT + 99 others); Tue, 15 Sep 2020 18:31:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:59530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727503AbgIOQRT (ORCPT ); Tue, 15 Sep 2020 12:17:19 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D468E21D24; Tue, 15 Sep 2020 16:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600186288; bh=OqNo4S1pwXf0y+OZFi5cbHnZ01UaP3lAlNY279lhRwE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1SbAjFtsROiRCnu7dWyqN1sIRZoFtHLH0MUJUYOlqDz9sybYMVk7vMa97tuhN/eXb 2X+dts4/sCSWx68z5lSHzmqQDfHvyzZxYUgNpCa4RxG/Ut4m70Zks3irGDXZRCVYTp oAQBm5qwIMsvFOtlPHV50y+STKCjMdNmVH4jbBoc= Date: Tue, 15 Sep 2020 17:11:23 +0100 From: Will Deacon To: peterz@infradead.org Cc: Oleg Nesterov , Hou Tao , Ingo Molnar , Dennis Zhou , Tejun Heo , Christoph Lameter , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jan Kara Subject: Re: [RFC PATCH] locking/percpu-rwsem: use this_cpu_{inc|dec}() for read_count Message-ID: <20200915161123.GC26745@willie-the-truck> References: <20200915140750.137881-1-houtao1@huawei.com> <20200915150610.GC2674@hirez.programming.kicks-ass.net> <20200915153113.GA6881@redhat.com> <20200915155150.GD2674@hirez.programming.kicks-ass.net> <20200915160344.GH35926@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200915160344.GH35926@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 06:03:44PM +0200, peterz@infradead.org wrote: > On Tue, Sep 15, 2020 at 05:51:50PM +0200, peterz@infradead.org wrote: > > > Anyway, I'll rewrite the Changelog and stuff it in locking/urgent. > > How's this? > > --- > Subject: locking/percpu-rwsem: Use this_cpu_{inc,dec}() for read_count > From: Hou Tao > Date: Tue, 15 Sep 2020 22:07:50 +0800 > > From: Hou Tao > > The __this_cpu*() accessors are (in general) IRQ-unsafe which, given > that percpu-rwsem is a blocking primitive, should be just fine. > > However, file_end_write() is used from IRQ context and will cause > load-store issues. ... on architectures where the per-cpu accessors are not atomic. > > Fixing it by using the IRQ-safe this_cpu_*() for operations on Fixing => Fix ? > read_count. This will generate more expensive code on a number of > platforms, which might cause a performance regression for some of the > other percpu-rwsem users. > > If any such is reported, we can consider alternative solutions. > > Fixes: 70fe2f48152e ("aio: fix freeze protection of aio writes") > Signed-off-by: Hou Tao > Signed-off-by: Peter Zijlstra (Intel) > Link: https://lkml.kernel.org/r/20200915140750.137881-1-houtao1@huawei.com > --- > include/linux/percpu-rwsem.h | 8 ++++---- > kernel/locking/percpu-rwsem.c | 4 ++-- > 2 files changed, 6 insertions(+), 6 deletions(-) For the patch: Acked-by: Will Deacon Will