Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3593988pxp; Tue, 8 Mar 2022 18:21:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3TQ8g9h/0YtU3LXXQZI3BNll+acNadDIMvvBcWhjzmCV88oLL6F+QbMxaxVr4RqrVaIna X-Received: by 2002:a05:6a00:2343:b0:4f7:be8:674d with SMTP id j3-20020a056a00234300b004f70be8674dmr11267943pfj.22.1646792466516; Tue, 08 Mar 2022 18:21:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646792466; cv=none; d=google.com; s=arc-20160816; b=q77umWYBFyQUQ2Xe+Uu/ZtN+sqEqAb2IaxmecsxSIrsT65HwaU5Tf45oXW5oBM211L TBWHyL+raddTgcS+Uinb0OCXkcnvs5/Gamrj8rOrblzwLAOuAyzTKkA6AAUGqEtkLk6K qhq0/kB02mTPMdjOvVtDTaFvZNkxJEEKRcu/Wzm+phRzpExPk5H4ekNRK94L5XAk6+Ia qsWcDcjfqEqLMG40lpsOI5tbFBlnL7EX88qosjuOGzPlcoWgVL/8toDQSCoKJ+U9qZM7 nSID/q97BHaJtf6V3wbtL0d6V8DOfjK6OA2Qai0EHUaNGE7cl9QnOUyMP5g6eiCKFThm U1pQ== 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=XqYDQ0sO8lLcFH38iNpLV9+za02YSz1bbsT0KsfeIP8=; b=VMkVe2RDhwycVhuMFEDUBfD9d+hjZd6CUQND/C65OKpqt1t58ltFSl6Zrl2RCyYrtM v71vkWPHB7KTAYg9UPJl2LyBGE5TfibkRB2BB9YVdIlCt8HtUvn51C9CXpYHarsW1Ack jMVzg3HVnzjeW0h/SknE845D10pdSs/A4C1A0Eq9nPGVeq2FjdPGAcICTEo/dzfmqRRm 0qUWwGi5xi1nRivcigkmDbLftF0Z8mpLVgEuWc8w5daqtFEBSIVESE8A78xneru99D0c Wf+84O2318gae5mTw8UgFM2nzrW+tzi5ovef5W/Tn5PXGhPzAcaCXbE1UZtWvX78gMRr pZFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="Pjh/y28/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e14-20020a056a001a8e00b004e1c075fb86si571931pfv.285.2022.03.08.18.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 18:21:06 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="Pjh/y28/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 516D0D761C; Tue, 8 Mar 2022 17:21:28 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbiCIBUL (ORCPT + 99 others); Tue, 8 Mar 2022 20:20:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230507AbiCIBT5 (ORCPT ); Tue, 8 Mar 2022 20:19:57 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BF5D30A for ; Tue, 8 Mar 2022 17:12:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=XqYDQ0sO8lLcFH38iNpLV9+za02YSz1bbsT0KsfeIP8=; b=Pjh/y28/PAdf3s2neTwwwFdFwP q2hbcI7URxbuj/rRtMJv+J+/zMaLs1xfegdV5hwwbn1TReO6VUZYFQnesEN9d+VS0DOtvRupX2AFL /mUpbgjG/CCa7zHYIUoIzvf8WvNFHOqK1IZwm9Di9sCZeI0Lm4LS+hVkMc2BvMzeIGDVh/UahgjdK XIoO1f3XX9cgSrxPjX1Flc9HQNbdxAWjNZ//HopeZIxaOmZdaxNOpObW2kc49+SOEWA7BEKrXyQIa NF+qhPF3PZU0H16aajB15UWjkI8Sr3HbdSJ+y1e8cUydVc42gBfRxZXIRbCHDaX/Cvi8OTKS226+A xqE1CzsQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRjJc-00GaWd-EZ; Tue, 08 Mar 2022 23:32:28 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 149C030027B; Wed, 9 Mar 2022 00:32:25 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AE5D0203C81E0; Wed, 9 Mar 2022 00:32:25 +0100 (CET) Date: Wed, 9 Mar 2022 00:32:25 +0100 From: Peter Zijlstra To: Marek Szyprowski Cc: Chengming Zhou , mingo@redhat.com, vincent.guittot@linaro.org, bristot@redhat.com, zhaolei@cn.fujitsu.com, tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, Paul McKenney Subject: Re: [PATCH v3 2/3] sched/cpuacct: optimize away RCU read lock Message-ID: References: <20220220051426.5274-1-zhouchengming@bytedance.com> <20220220051426.5274-2-zhouchengming@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 09, 2022 at 12:20:33AM +0100, Marek Szyprowski wrote: > On 20.02.2022 06:14, Chengming Zhou wrote: > > Since cpuacct_charge() is called from the scheduler update_curr(), > > we must already have rq lock held, then the RCU read lock can > > be optimized away. > > > > And do the same thing in it's wrapper cgroup_account_cputime(), > > but we can't use lockdep_assert_rq_held() there, which defined > > in kernel/sched/sched.h. > > > > Suggested-by: Peter Zijlstra (Intel) > > Signed-off-by: Chengming Zhou > > This patch landed recently in linux-next as commit dc6e0818bc9a > ("sched/cpuacct: Optimize away RCU read lock"). On my test systems I > found that it triggers a following warning in the early boot stage: > > Calibrating delay loop (skipped), value calculated using timer > frequency.. 48.00 BogoMIPS (lpj=240000) > pid_max: default: 32768 minimum: 301 > Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear) > Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear) > CPU: Testing write buffer coherency: ok > CPU0: Spectre v2: using BPIALL workaround > > ============================= > WARNING: suspicious RCU usage > 5.17.0-rc5-00050-gdc6e0818bc9a #11458 Not tainted > ----------------------------- > ./include/linux/cgroup.h:481 suspicious rcu_dereference_check() usage! Arguably, with the flavours folded again, rcu_dereference_check() ought to default include rcu_read_lock_sched_held() or its equivalent I suppose. Paul?