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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74B5EC43464 for ; Fri, 18 Sep 2020 10:04:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30960208B8 for ; Fri, 18 Sep 2020 10:04:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="kpjP9gHl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726375AbgIRKEl (ORCPT ); Fri, 18 Sep 2020 06:04:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbgIRKEl (ORCPT ); Fri, 18 Sep 2020 06:04:41 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54517C06174A; Fri, 18 Sep 2020 03:04:41 -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=q0zE53Mklt4PMv82Yhr0kJeZ6KhXh1hhrqSKoGIyh/4=; b=kpjP9gHlUv2ZMQ11ObT93sJFCo sSdoKxLyuRS1HpG4t3+6ez0r1TAvwJem2GeTCeChfLOh/44FZooqFj/1Yh7wLpBYUh0Bl4ZYrkoyA nvX2A9fAoMQInSY2bySPFIqVmN8MIF6IUUgbj/MX2qkR8J11u+Nvf+7QHIyPVGf01Y4BLIYIIaeUC 2XBNgy0G2XFDPUc0udBgbAfJd3G3tjh673isGrmgH3R86R/0eNSA1LFgbLC0FxAHBU3NEGmYjHYQW BoM3fznMoSX8ZzvgdzUTd62h3kOtpxcDlTCUFo8jaG9x0gn7QGPw5zuiDECmFesI8Lh50rGsk4m8N OA95Pwbg==; 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 1kJDFq-00036o-Go; Fri, 18 Sep 2020 10:04:34 +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 74802307A20; Fri, 18 Sep 2020 12:04:32 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6326D2041904E; Fri, 18 Sep 2020 12:04:32 +0200 (CEST) Date: Fri, 18 Sep 2020 12:04:32 +0200 From: peterz@infradead.org To: Jan Kara Cc: Oleg Nesterov , 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: <20200918100432.GJ35926@hirez.programming.kicks-ass.net> 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> <20200917120132.GA5602@redhat.com> <20200918090702.GB18920@quack2.suse.cz> <20200918100112.GN1362448@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200918100112.GN1362448@hirez.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 18, 2020 at 12:01:12PM +0200, peterz@infradead.org wrote: > @@ -198,7 +198,9 @@ EXPORT_SYMBOL_GPL(__percpu_down_read); > */ > static bool readers_active_check(struct percpu_rw_semaphore *sem) > { > - if (per_cpu_sum(*sem->read_count) != 0) > + u64 sum = per_cpu_sum(*(u64 *)sem->read_count); > + > + if (sum + (sum >> 32)) That obviously wants to be: if ((u32)(sum + (sum >> 32))) > return false; > > /*