Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp592557ybb; Fri, 3 Apr 2020 08:22:24 -0700 (PDT) X-Google-Smtp-Source: APiQypL1VvAVhtSQnHJB+5YQyJfU2OYl+b5o2JPisc2Z9mne5BXe4VcNA5AvykLesyFwDUAfDtNJ X-Received: by 2002:a05:6830:199:: with SMTP id q25mr7156054ota.341.1585927344241; Fri, 03 Apr 2020 08:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585927344; cv=none; d=google.com; s=arc-20160816; b=PUxSIO9EpwM3nTXitp7ei1qcy0ZHKFE/9c/qNNMm7kU06IOIOTRP1D6DXBxdR8cvB6 y1aBDkihP8FvPEtVC+q6HX0v5Ye9rPLe9qWzQdKqDv8po3HNZ8SiaBy6Xii0OJUf2Z42 Ws0fZ0u9KR6ZiYoJm44yoOFm6Pcsc3yS2kuOAeoxVQoeur+SEW+6KFsbdGr7zmSJHtTr lp8IyDjLtMwTn/YRclwP9WoDeyZnlT2iyTfyRPuj/RIOeVaCnxqZAtswVgZdoLasJsmJ ysmwP8/PZSRB2TFdEoLMb0dmqa4N7mgMFAXlmOieaThB+y3AtdM5aMORfb6YMe75si/K R8XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=pcySYvcjsOIXyHu4jeus+Gw8MtcUshidVKxTeJv8K+g=; b=HNk0IIfnjvPkcnxfiYSLWUh0bT0604wsPYHb7HphfAadg0jrocYreXvkwV0KU1PVnX BtSD+RZoCqxOLah361wIHoZffQklqkKhFwk8sRlJToLLGfBnidys1F+G+UUpZ03/xlAi WLJSGN7OPuekXY4DDRyOJhrv5iKG7eVJGhuT7d45YuivYn52IrE3udwQzCNjzGEm0yqV UpugcKl3Sd6UzprrakqGPATy8yt/OzraGY8DN30CK1iB32CkwQbs9YGbPoNPVY21JhWQ lagPgSplvh+mzhekvXO6ZIsOZ4U7pnFUqfBPnCVcWe+knXNqmCbF9LemwUWnrBjeXmDA lYHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=BPMLO0Tm; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i11si3938190otj.33.2020.04.03.08.22.11; Fri, 03 Apr 2020 08:22:24 -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=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=BPMLO0Tm; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404081AbgDCPUU (ORCPT + 99 others); Fri, 3 Apr 2020 11:20:20 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:38386 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403991AbgDCPUU (ORCPT ); Fri, 3 Apr 2020 11:20:20 -0400 Received: by mail-qt1-f194.google.com with SMTP id z12so6723221qtq.5 for ; Fri, 03 Apr 2020 08:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pcySYvcjsOIXyHu4jeus+Gw8MtcUshidVKxTeJv8K+g=; b=BPMLO0TmyHJ12cXzSNYL9F5s7rDKsc+quN7feDOTATPnaoZZ1WuPeHjqFkh771hN8I 5ClXJXIdndynCbHw1/KwNjdgz3L5zj7TWXo7HC90T3YUk1pKG/dDbNtjTgZL3b8ekPmX qG0pWrfP/jMZpl+0sihgIj54o1czyUj9EtHKTbFmNxL8ojwsKIKNxgiiWtyfRAYHI2u/ CuwnXaudaY80eigJJzUl1R4WVZLpYQdHcbLWpD9GJ7+PzO3E0aXv8PSLTp9LDkf09Vg1 HDb93LncSH0MmoyQTMT7Gwe9hSJqe+QMKgqQD8SxGJMi8QPZWXmJEfmBkGgcMNavsSBp gxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pcySYvcjsOIXyHu4jeus+Gw8MtcUshidVKxTeJv8K+g=; b=BijYKQlii6oCOt9/BFcuvZ/ECimIKOrYirpVWTLRvhgYBRZqWLBj2sR9SyIO6G2IDs yVOYgnXyoglET0MlNw5hc70TfA5VpEoqLrkuY4v3n8J4ZFYsCCkTWZtnQItTH6Rb2qtD jQYwo/PWMe6SobBGFqkLog2DbdIkcsYiLiJ/D1xKwHiqPtlPJ+yaTLIb+9hPWwD3vi0P 6Sny1wMX2dtjDfolOQS6ZQ/ZUET++peEp8M4GQXUmcGs3vUoLcgCxH+hnl26pntxUX+4 iFNQp51DD9KpiiEa4RNRko9fjeCWXAFEhQrhiPj0VWPUS3jfCY/u6EpIFgOfDq95Oi5V nf4g== X-Gm-Message-State: AGi0PuYLUCCnuwWmuSOE5qayLqAvmihtJscMlL54gSnhiiujasO7lBK1 n/yfW5ycFN0pkCeQQjHGkJVk2A4xd9k= X-Received: by 2002:ac8:7385:: with SMTP id t5mr8787026qtp.222.1585927218874; Fri, 03 Apr 2020 08:20:18 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::da28]) by smtp.gmail.com with ESMTPSA id f1sm6106148qkl.72.2020.04.03.08.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 08:20:18 -0700 (PDT) Date: Fri, 3 Apr 2020 11:20:16 -0400 From: Johannes Weiner To: Yafang Shao Cc: peterz@infradead.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Daniel Drake , Suren Baghdasaryan Subject: Re: [PATCH] psi: fix randomized calculation in record_times() Message-ID: <20200403152016.GA69203@cmpxchg.org> References: <1585904125-2819-1-git-send-email-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1585904125-2819-1-git-send-email-laoar.shao@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 03, 2020 at 04:55:25AM -0400, Yafang Shao wrote: > @@ -690,7 +690,10 @@ static void psi_group_change(struct psi_group *group, int cpu, > */ > write_seqcount_begin(&groupc->seq); > > - record_times(groupc, cpu, false); > + if (groupc->total_tasks) > + record_times(groupc, cpu, false); > + else > + groupc->state_start = cpu_clock(cpu); This change appears is a no-op. If there are no tasks, groupc->state_mask is 0, and the only thing record_times() does is groupc->state_start = cpu_clock(cpu); Did you encounter actual problems, or are you just reading the code?