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=-8.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 97B45C433EF for ; Thu, 9 Sep 2021 15:54:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2F6E610CE for ; Thu, 9 Sep 2021 15:54:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2F6E610CE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8A6D06B0072; Thu, 9 Sep 2021 11:54:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 856806B0073; Thu, 9 Sep 2021 11:54:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71E44900002; Thu, 9 Sep 2021 11:54:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id 617276B0072 for ; Thu, 9 Sep 2021 11:54:37 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 008F382499A8 for ; Thu, 9 Sep 2021 15:54:36 +0000 (UTC) X-FDA: 78568482594.13.25C10CB Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf20.hostedemail.com (Postfix) with ESMTP id 8AC63D0000A2 for ; Thu, 9 Sep 2021 15:54:36 +0000 (UTC) Received: by mail-qt1-f182.google.com with SMTP id l24so1825059qtj.4 for ; Thu, 09 Sep 2021 08:54:36 -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=lNkOobc3fvllVNhfS015DlznHrwl6HCxnMSWZ4cncKQ=; b=hOeCR/JJuW3vq5krtQ04NqAe3NRp9UNakz/JaDhHfDTZXY284UOdc/H3BIkQrQt4D3 2keTTfRtZtd8VXUfZ9/WHkaa+4yY59N15v5RRRDVZXIiZR5oQRWBUAsmXgDywC8AXUQf p1lc2oep7lRHbwWCCMkvGXUqRXldKb0T4q/tnxwLCMFvMPsE0mAiF3B1M7CxRRNDbJTJ VCEbEW3/BeqBqzXEJ1QPMMO7xwsBOyNng46vZOrHKngRonUTKFTflKhBX++Cbjrb3/k0 hMP7o1hCue6h2FAzSthtp4Xs9izE3FJcX9Ye+xndsOvyNsj9U5Hzylw5CFHQ8HvW7TMS 9OeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lNkOobc3fvllVNhfS015DlznHrwl6HCxnMSWZ4cncKQ=; b=Y655KiDOQEiJBSWNUaXFOIAtCrk95A2OzPe1I6wY5bj8AVE5nZsamevreXgD4y4APi /+T7/Le86Gq1FV1OujpvguqoEai3v7z4s3CfB/Uii7OM97bQq14qF5zEa55KhR5oD5rf bE6YcZO6dEEUsMLEqdSE5zduP3gGIBhH4WK9VaaJKYJ/zCkWTAQJIke5tc/HybZJ86R7 EE2wwCZx5+n878YSK7nFNaTlHtnHMQxM2ip7HXu8fRmkVdGispA8pImAxuzUtQMSoGaf A9FGtQPj4f3ji87t80GPt56EszVlRK5/bIU9JVzFglG41odaXDp+ebXMhqJ2PSNWC2NY XuJA== X-Gm-Message-State: AOAM531AkU49Oqr9AjoYZA58DGOw7cWnJuysorH3skoh01AXjUbv3dF9 WomhpMgU4er1JKwne35UecgbQw== X-Google-Smtp-Source: ABdhPJyAenaHR8h2iXKo1iDFqmURb78xjYil4jnfjAijvBPE9Zc4iIAAq2xHYlW/b76M4RVxlmECMA== X-Received: by 2002:ac8:6a0c:: with SMTP id t12mr3427239qtr.159.1631202875799; Thu, 09 Sep 2021 08:54:35 -0700 (PDT) Received: from localhost (cpe-98-15-154-102.hvc.res.rr.com. [98.15.154.102]) by smtp.gmail.com with ESMTPSA id f6sm1523925qko.85.2021.09.09.08.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 08:54:35 -0700 (PDT) Date: Thu, 9 Sep 2021 11:56:26 -0400 From: Johannes Weiner To: Huangzhaoyang Cc: Zhaoyang Huang , linux-mm@kvack.org, linux-kernel@vger.kernel.org, xuewen.yan@unisoc.com, ke.wang@unisoc.com Subject: Re: [RFC PATCH] psi : calc psi memstall time more precisely Message-ID: References: <1631188824-25623-1-git-send-email-huangzhaoyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1631188824-25623-1-git-send-email-huangzhaoyang@gmail.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 8AC63D0000A2 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b="hOeCR/JJ"; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.182 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Stat-Signature: xmo9psox36xd6q7yzowaqd1swk4jt3zo X-HE-Tag: 1631202876-781889 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Sep 09, 2021 at 08:00:24PM +0800, Huangzhaoyang wrote: > From: Zhaoyang Huang > > psi's memstall time is counted as simple as exit - entry so far, which ignore > the task's off cpu time. Fix it by calc the percentage of off time via task and > rq's util and runq load. > > Signed-off-by: Zhaoyang Huang Can you please explain what practical problem you are trying to solve? If a reclaimer gets preempted and has to wait for CPU, should that stall be attributed to a lack of memory? Some of it should, since page reclaim consumed CPU budget that would've otherwise been available for doing real work. The application of course may still have experienced a CPU wait outside of reclaim, but potentially a shorter one. Memory pressure can definitely increase CPU pressure (as it can IO pressure). Proportional and transitive accounting - how much of total CPU load is page reclaim, and thus how much of each runq wait is due to memory pressure - would give more precise answers. But generally discounting off-CPU time in a stall is not any more correct than including it all. This is doable, but I think there needs to be better justification for providing this level of precision, since it comes with code complexity that has performance and maintenance overhead.