Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1138781ybb; Fri, 3 Apr 2020 19:33:25 -0700 (PDT) X-Google-Smtp-Source: APiQypKXJaeWE1HnUO/Lyrz4NTQH0RQjr/TFAcE1uEInZn6ZsYYifbdkuTmccVoI8QUs1eCLYN9b X-Received: by 2002:aca:fd44:: with SMTP id b65mr5074061oii.119.1585967605373; Fri, 03 Apr 2020 19:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585967605; cv=none; d=google.com; s=arc-20160816; b=uKCKSA0FrYqNNGw6+moCxn678UYyR6pV9OpUFbDG8tagyYkwkRGf7sFd0+nBaz3ALr /p77gEItnbn4NecIUbrCfeXydFbGI0IpVu/U071X6m3lpOWk+zi7B58bX7mv2FNBRUq9 5B5HIFjyYHIh1MhqG/yB4ECu0T+6KZiU5cj676ITBwazYhwJY/yTlFIZ9QFAmXTdwezu EQQj4Amr8qELt3ElBl4Q2qSMhRXp0t6laq2UbjS54qahYVTEGfgbJRLhDUtw756DcrZl btSpYUIYxUIA6Cs2wPdMcc61/HEbea+OY6Lk1L/8pe8KY82/OoLCc144WAbNCnuMotYN Y1mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=73jqoDJR4Hmz4eV5wHtz3Ds21ROllKQjJV/hPH99ZdQ=; b=UYMmoe1VmfQQ22XByI9LYphqY1NclrwZKH766/xoHnEWi8Gbv7WAwkv2lp1vpsCuyC c7VgyaojILoILLV56PjnyyPOeuDfei1lqkB5Jk7zrmolzgwc7AxOvCQzmwBqX1dpv2dg VrZJ9HbNJPEavlkG/yXYyoreGrCIRn7UxI71Jg03JhG+a6wK9TP2Rc/pOHn2+X0HDRi2 1rt99odDw2BSqVRD7Lj411imt68UZHjunqRhNHlFFdD3xKkp96Ny9d+Jth6vF3K/rFiS hhW7U2qpOyZBJJbvNprmUNlWg1AMB5i8a2J+oEhMI3nl5mB5A8QRPKZPVfxsF6LwNewZ 0+Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VDVyVD03; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p21si4996295oth.257.2020.04.03.19.33.12; Fri, 03 Apr 2020 19:33:25 -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=@gmail.com header.s=20161025 header.b=VDVyVD03; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726258AbgDDCbx (ORCPT + 99 others); Fri, 3 Apr 2020 22:31:53 -0400 Received: from mail-il1-f196.google.com ([209.85.166.196]:38296 "EHLO mail-il1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726186AbgDDCbx (ORCPT ); Fri, 3 Apr 2020 22:31:53 -0400 Received: by mail-il1-f196.google.com with SMTP id n13so9389811ilm.5 for ; Fri, 03 Apr 2020 19:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=73jqoDJR4Hmz4eV5wHtz3Ds21ROllKQjJV/hPH99ZdQ=; b=VDVyVD036uSZxfqSuWAQxWfPYz/hc1ryWjFRuLKKKmkrG4I2N9Uc4OOCMghKZeSZdo 05vsC2nxlbYe1LIKVCaHhhrgrSFnZprq1B6P6/EgMJfwm1Rf6ZvruR5bYPhpkYfdhrvm a/8s5P0Ad2/3iJXlEbt2prcubwNr5gzhjvQ8zgZMNLKh2IfcbaueRCu0pH7eswPzPcTk zKlgXy/O9sZAR4dNEUN/SNXg5Ls7L5D3RhSKvL5zU7d8DmKFoLiYQEBkvaUNaalQ1qNn FLaac3BmihOPIWBrjSnM5RZf2jVKS/X0RhOuVcgbJS6tcLsHqG0M31BLvrOK+DICCtWN wKyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=73jqoDJR4Hmz4eV5wHtz3Ds21ROllKQjJV/hPH99ZdQ=; b=ecAjLlfALmtiXSvflsBijXqwurE4hdGcVfNhHcgArBbw4D7XrNlqziaMxNOtSlJsXU KzzPWJrqU87KG0gov+EK9kyRkzuKPKjQPTvk9rBYGTebzhxBTuahSsjW1r55ZGHVkFv4 XZXiOs9Dn/lgQ8hdQop2FDkr/N6bAZM0+vqzq8ibPoWQUHX/f/0gdqiW3KnxwgPrSWOP NLrGfXymai8f2aa8ijG2iz/3kFBmeFzy4YNpmoYsFwQlMIwgtzN7xKZvnOZkWeWlmc6j vgdWAGiBA84A18hFoiJezK6DH+mfhSsm4+bSGNplC4yYpIXol1TYWWALe+Sia4MibUXF 72Jg== X-Gm-Message-State: AGi0PubfBuRa94nEhYxOLLsskxWzaqkTV6VD32YoU/GeKmyDJXzdds5E M2g1qWq5xf1vkNfsA9eaFaJ3ciw59swl7YQVETQ= X-Received: by 2002:a92:d105:: with SMTP id a5mr11645280ilb.142.1585967512259; Fri, 03 Apr 2020 19:31:52 -0700 (PDT) MIME-Version: 1.0 References: <1585904125-2819-1-git-send-email-laoar.shao@gmail.com> <20200403152016.GA69203@cmpxchg.org> In-Reply-To: <20200403152016.GA69203@cmpxchg.org> From: Yafang Shao Date: Sat, 4 Apr 2020 10:31:16 +0800 Message-ID: Subject: Re: [PATCH] psi: fix randomized calculation in record_times() To: Johannes Weiner Cc: Peter Zijlstra , Andrew Morton , Linux MM , LKML , Daniel Drake , Suren Baghdasaryan Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 3, 2020 at 11:20 PM Johannes Weiner wrote: > > 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? No real issues. Just reading the code and found it looks like a little weird. But as you explained that state_mask can also guarantee it then we don't need to make this change. Thanks for the explanation. Thanks Yafang