Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1132725rwi; Thu, 13 Oct 2022 09:26:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zR5iSPyKZdDmvr8y263q9ovX29yKEDC5OZhFYADBgqA9HCyvkBXgtZ8a/Y8u8AHVxYf+4 X-Received: by 2002:a17:90b:1d83:b0:20d:7e1e:fa51 with SMTP id pf3-20020a17090b1d8300b0020d7e1efa51mr624405pjb.131.1665678394357; Thu, 13 Oct 2022 09:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665678394; cv=none; d=google.com; s=arc-20160816; b=RJBDho/zX1mdu9KhFlmc8BVU2nu+ARkNSW95PNyyEZVgeE1zVmdbYNI38XXati6coE IbNim+4GrCuO+PpeUHKKOzjdUFQeD5sty/tvja1bPAKqJuDKTDTeaoSXQOoGEs2dibV7 N3nPdMN8WikuKKVkSvexZuwRoFopfMxoL6WPff6xN5jwsMR0whYN7hGbOcD7glsI3K0P DvJJpk80S/7krKHH1J0oK1eHuF56vVwozKa2Bo5OdB9N7FvUpXov+KobJESEk07+5sz/ FnZ6bzW0ZYpcbxXn8QbXn0zgZ+3IQuTWVIpb8srZ9XDpMD4IzK7/R5WzNUv1mQ0SXdej cR6A== 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=bWMv3DmVinwzc+hnXTMc4Pdb2dwueFn5cUn33fiS298=; b=pnPt5FRinX/jODc/cacLKytWL4iTlQQJo7Y9jwnWJhbPNqjw+S9QBm4q9DWLmNLH2U k5uoWJIGvj+I4MxxzbdMomnM/dLOrP6OaFgEJsLZJyYJioChj3Au6yfl0w5DvdhZ8l1P 4xsgqKmh01sdL4aGxG4QyBUVquHNW38zlkAAx6ZVFBHQ/H76kXoKiLR1NMhOGpIWohFX IzuRm30g9TYEwBxLocN5vWubIzaA9tM3gCFfzu5XLWHKegipvam3R6LV6f5laP7KU5Go NJQ83zztp3kDLK4IiCbYaaLnP9BzBILkia02pkQD0djYpVCuPIcAJCsmHwGzo+UJmR4j bcMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=Rx+1ixrO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a17090a680400b0020adba9ec02si5087814pjj.82.2022.10.13.09.26.22; Thu, 13 Oct 2022 09:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=Rx+1ixrO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229780AbiJMPwy (ORCPT + 99 others); Thu, 13 Oct 2022 11:52:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbiJMPww (ORCPT ); Thu, 13 Oct 2022 11:52:52 -0400 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1606CFF8D9 for ; Thu, 13 Oct 2022 08:52:50 -0700 (PDT) Received: by mail-qt1-x82e.google.com with SMTP id g11so1623180qts.1 for ; Thu, 13 Oct 2022 08:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=bWMv3DmVinwzc+hnXTMc4Pdb2dwueFn5cUn33fiS298=; b=Rx+1ixrOX8U/D56rpEjVFONZ4Eeos6N/Uzey9b3QCI6MuLHNJWdG1/VDtRTNfxrjWa 92kkEbL7E9wSYIkv82x/LHCoj+4DI9ApKdxnVkq6MQfKxeKoztUA+p0lF5Ihx0XylN/L bux8C9DmEnYR/F6xLA4JU20Dj0n0F+KT9FD+wn3B8uc6UwbDbnaLFGEpaTa9/XmUu0N/ LBDNW2OZJ/GoqXGL1A//DFW67sjLo8L+mgEe7+fcf3IXfA1GrsFGMb934CbNDG0q6xgA 2qiSD+oQNwdg7z5bDC/kuJsRzzzdh3YeTUVOyBLZUGB+97fcOsTRS3+wyWYULWJhHbnX BPYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bWMv3DmVinwzc+hnXTMc4Pdb2dwueFn5cUn33fiS298=; b=RFyWVg8tGwF1w7Km1ekdbCPHxy3nKBwCQHRtIZDKPQ6IETJvTplWyHAoiqd4VevOYS 7OkUEuobsYTmqPCPShFjrk3GwbDHVkJ7bq2cP0aOKvv3toh875mormnIy/THAdBdLQcc 90PMN2zn9JKbEr4rKe8t5Id4pImIHkdhMxedjARqLM2T67H8Y2ozaswPRDd5SEb3Hfy4 xd4TT4yh0sTcxyG+1P3UMenJBG2N/6PeyeLY4BmbgYpTnicUPUnw6HhYF+LDmgleAy0I wbXc173irxKeRrDFYylFltcnrzEnFkvIMHDHApyQmTJr3Pg/180/+hCopNaimRbhNflX cHhQ== X-Gm-Message-State: ACrzQf0MLY8jSaddlKHrwKY2cyYiof/Vjry9Tuc+yOYL/VGGWgc3xJfS jFXHGDnd78ex1zolg/rmVjNSMf0W1C/u9Q== X-Received: by 2002:a05:620a:6004:b0:6d4:56aa:430f with SMTP id dw4-20020a05620a600400b006d456aa430fmr392091qkb.579.1665676369885; Thu, 13 Oct 2022 08:52:49 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::3a61]) by smtp.gmail.com with ESMTPSA id s19-20020a05620a0bd300b006bb8b5b79efsm5906qki.129.2022.10.13.08.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 08:52:49 -0700 (PDT) Date: Thu, 13 Oct 2022 11:52:48 -0400 From: Johannes Weiner To: Chengming Zhou Cc: Suren Baghdasaryan , quic_pkondeti@quicinc.com, peterz@infradead.org, quic_charante@quicinc.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched/psi: Fix avgs_work re-arm in psi_avgs_work() Message-ID: References: <20220913140817.GA9091@hu-pkondeti-hyd.qualcomm.com> <20221010104206.12184-1-zhouchengming@bytedance.com> <46c6e1cc-77d3-eac1-fa18-deed2bac4a0e@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46c6e1cc-77d3-eac1-fa18-deed2bac4a0e@bytedance.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Thu, Oct 13, 2022 at 07:06:55PM +0800, Chengming Zhou wrote: > Should I still need to copy groupc->tasks[] out for the current_cpu as you > suggested before? It'd be my preference as well. This way the resched logic can be consolidated into a single block of comment + code at the end of the function. > @@ -242,6 +242,8 @@ static void get_recent_times(struct psi_group *group, int cpu, > u32 *pchanged_states) > { > struct psi_group_cpu *groupc = per_cpu_ptr(group->pcpu, cpu); > + int current_cpu = raw_smp_processor_id(); > + bool reschedule; > u64 now, state_start; > enum psi_states s; > unsigned int seq; > @@ -256,6 +258,10 @@ static void get_recent_times(struct psi_group *group, int cpu, > memcpy(times, groupc->times, sizeof(groupc->times)); > state_mask = groupc->state_mask; > state_start = groupc->state_start; > + if (cpu == current_cpu) > + reschedule = groupc->tasks[NR_RUNNING] + > + groupc->tasks[NR_IOWAIT] + > + groupc->tasks[NR_MEMSTALL] > 1; > } while (read_seqcount_retry(&groupc->seq, seq)); This also matches psi_show() and the poll worker. They don't currently use the flag, but it's somewhat fragile and confusing. Add a test for current_work() == &group->avgs_work?