Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp256603pxb; Mon, 13 Sep 2021 18:32:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmNp8kdWYfOkuOwrMoR/+Ai7e+SiibZofKuzMfAXcJ8m6qvVVY1V6Auzyuz0xB8soHkZ6v X-Received: by 2002:a02:711e:: with SMTP id n30mr12387207jac.3.1631583172783; Mon, 13 Sep 2021 18:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631583172; cv=none; d=google.com; s=arc-20160816; b=R4w9EAVQz127yl/0suCnaFaH7dSGcPgSTqobw049GavF0tg5DiVMcljduDmlMwak3i 8PUQix+HzSX6600XLf8mjKG0LKWC/BB03Cs+yJULcaaTf1oSCuopAFRoU6sT4AVQzEGM PARwdIz2LmkeNM4ezIMGHls/10+7ee2hp5Y6x2lUm5f3w9pYBTH2EiJ6RDFbG46GrXBv bhMGBn3fwzhmuPD19gqEYIGVn+OtrekoI5zcC6Uh0CN2kUT7nZ7pFJ/L6ZZSHAsX+b5y CW9PNZsb60tZEWXAcw8R1tTfv5zEg/A9dfdJ313ekn/10Wz67qnnIxnzMus2GuhTLLfP qK0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8zeFrHijeuDDSgea2thpakNO3UstBjJsYAAwyq56two=; b=GvHQu7XXc/yEz+v66JPZfl76QhcjOg4oAhuGpHNHilQNgNidSJDhFvGQAhhVPHhhzX 7H8n7B7ZcCouC0cO1sv4aCHUUyjr386R1Awc+9ejnVCuxr4oslMfAl1tuwcBpt1DxTND ZrMLxy0I62xSDQY+ymjG+9+llzV9/0sAxOct28JG20DCRLyL/2mr+OqPQ3ZA8/hlhC7h cWaeNdvsQhHi0bBfu16Wrr2AMg13kvlBgwRZIURKhTX3toTMFWD8bdBCyFtHysrKC5e9 HKDiqDHWuUMRsUfAw5ujAHGBfVo8UYfyYyYLBHWZBinjIz/kPSzJQScJG4M2SIlQU7yf qT2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YIQHhW+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id a4si8914667ilt.54.2021.09.13.18.32.41; Mon, 13 Sep 2021 18:32:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YIQHhW+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S235705AbhINB0W (ORCPT + 99 others); Mon, 13 Sep 2021 21:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbhINB0V (ORCPT ); Mon, 13 Sep 2021 21:26:21 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05912C061574 for ; Mon, 13 Sep 2021 18:25:05 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id r21so9907942qtw.11 for ; Mon, 13 Sep 2021 18:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8zeFrHijeuDDSgea2thpakNO3UstBjJsYAAwyq56two=; b=YIQHhW+ZnjrjtKrGd8pHMXPiZJ50qUQ0iOC/25IJGJEZpaYUSt4QPmzq0av6x1Euvo 1WYSm0VMnNc2MnQAE8LN2Nng1BcKKn02FNVLI6wsTu4s+2/VKsrvHizh/SVpDlZUDkVe QeawM4MI2DK7zN2IM++TJXzkjRqvG080nqfMgMBuB2V5HA4WWu5c3wr+gR0tECy4ikNX bEBBhPAeDBP7A2gJSm4awv0B70PpXL2T3aUXeLNicEoirvh9F668oL+Xt+iDBIpNsjh0 z3wxVaTpSe4CRXuaBnrffFMNHRLBLL1Q+b5n8LXKsDB+9dBgSVleSXRQYopJTAo1UAGx QWVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8zeFrHijeuDDSgea2thpakNO3UstBjJsYAAwyq56two=; b=ZSTVNKXOo9MKcU6NaBQi7dXQCAVgJwEdUhxTnxUOA37ToAm+qCa8qFPD0iV4Rb3Gcu E4w/4XWWCb3Z0V2uAQBWvhoO9Pu2HAbPpEsyU1r2SJ+mihG+on4yxCw4nY0CAHbQWWMf d1ihR0PT2Qr7NhMtof41onOJ97DYBg8FTKpwhz0QyOyNN1va5sqPXORlm+XAZexBILRs VMuw48DfxIXM2BEpUSf5khhSh52AY3gHVbKsoKYsapllOgWD47+MMsK2/bpH7MGnuKTG UOFyyCZ+YiuGF22c6+TrW25zD8VnSd74goPa05PPnBtQmxeNR3CQbZWjkuqYY0qQivM0 LdIw== X-Gm-Message-State: AOAM532XWhr6d1Cqjb0ijJTy3Dm7o4XWgdIAaGK9vjxWWA7r13w+dVZA POFuzpYd0GrLTwgt6O+4q/3G87yyT3K4hz7XKwp7J9E9MOk= X-Received: by 2002:ac8:410f:: with SMTP id q15mr2260768qtl.299.1631582704131; Mon, 13 Sep 2021 18:25:04 -0700 (PDT) MIME-Version: 1.0 References: <1631188824-25623-1-git-send-email-huangzhaoyang@gmail.com> In-Reply-To: From: Zhaoyang Huang Date: Tue, 14 Sep 2021 09:24:43 +0800 Message-ID: Subject: Re: [RFC PATCH] psi : calc psi memstall time more precisely To: Johannes Weiner Cc: Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML , xuewen.yan@unisoc.com, Ke Wang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 9, 2021 at 11:54 PM Johannes Weiner wrote: > > 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). The preempted time which is mentioned here can be separated into 2 categories. First one is cfs task preempted because running out of the share of schedule_lantency. The second one is preempted by RT,DL and IRQs. IMO, the previous is reasonable to be counted in stall time, while the second one NOT. > > 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. The rq's utilization of load tracking provides an easy way to compute such proportion. A new commit has been given out which mainly deals with the 2nd scenario described above. The statistics of the precision are provided together.