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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81F2EC433F5 for ; Wed, 10 Nov 2021 05:38:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 059CE61205 for ; Wed, 10 Nov 2021 05:38:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 059CE61205 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A262E6B0074; Wed, 10 Nov 2021 00:38:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D4906B0075; Wed, 10 Nov 2021 00:38:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89BF66B0083; Wed, 10 Nov 2021 00:38:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 7CC976B0074 for ; Wed, 10 Nov 2021 00:38:42 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 296A818206D24 for ; Wed, 10 Nov 2021 05:38:42 +0000 (UTC) X-FDA: 78791916084.07.6CDB8B9 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by imf24.hostedemail.com (Postfix) with ESMTP id A569BB0000B0 for ; Wed, 10 Nov 2021 05:38:41 +0000 (UTC) Received: by mail-lj1-f180.google.com with SMTP id v15so3106086ljc.0 for ; Tue, 09 Nov 2021 21:38:41 -0800 (PST) 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=fDtvbV5LxV5z9R4yo8jwMsLWShI2ssXYnCOglSG/Vk8=; b=qamOWrHxyZagjomM+WM8QbTHUqyyR0Kmhre52bHOun/0mZ4ZSW0DtXoB61SeNbsx/9 lM287W3whV7P0B5iHWxNW0vKg5yPOyqF+foacGly1baS95FU/NTEJ06X+wp32Zm28S97 DKKYz50h56k5q6rD9ASrtp0KSlYPNHYri2SSprNg//Yi1e824Zqexs5vQMmVjtVipqtU sBnnFD3bugd92DykIHl4b7edlEVyQT4FA5MioKdZ0/0YLUNlo7z5giXubPdkz/CjzxED oUF11hywZicr6ogEb4PwJ4nLRftSSsJZNYsnrdmrQw5PbOhrYlkQVRCkhbOInBGADDIT YN0w== 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=fDtvbV5LxV5z9R4yo8jwMsLWShI2ssXYnCOglSG/Vk8=; b=WCHzBmsVjVZ3dRX/u+xSQYbLzWVOzoiLnEMG7N4M/22Nf6+nmDJze457valwi/7Oa/ C1cttVJd5/tCKprGZdazGo830luUft2Vrka8Qw8aHNU8+oQ/jBui0C3YKqS+WFSaIgeL XyMUET6jkd891kOZbBNcXGCb0alVAS+YdrQuXHOhKiiiraOLWLo4g1XLQNo/bYhbHWKv O/P3fJ9ymfLxRnzc+O+oceit7PvzuIKub3ATfFI0iGDpKBFCgGEPyJ3t3uR6Q8pcPky7 shTS7K5KI9A+0wlW/ywGOzg2ZyGVOeFXJOPYHVTU1iKKafUpUVgQlXS4oaMJlRmNUFMQ f/ag== X-Gm-Message-State: AOAM533oMbxK2ARycYZq0rSh36JL9wOpeNMzHgZQZdCi/MrT700pKNo3 ZZ+fyIsy+M3Qkg/qxq4FJs4apBWTLrH1WU0pW1pAXlL+ X-Google-Smtp-Source: ABdhPJy9NN4VshdRDEzj07i1vT3EYszoUdzpZlAtJxKW8AENVtcHXsKHFW4wCiSCRJssiXymVm24D+qoAAUZKv/nMkc= X-Received: by 2002:a05:651c:1036:: with SMTP id w22mr13019766ljm.356.1636522720425; Tue, 09 Nov 2021 21:38:40 -0800 (PST) MIME-Version: 1.0 References: <1634278612-17055-1-git-send-email-huangzhaoyang@gmail.com> <78b3f72b-3fe7-f2e0-0e6b-32f28b8ce777@arm.com> <85c81ab7-49ed-aba5-6221-ea6a8f37f8ad@arm.com> <25828616-1976-6e24-cd7d-a95b789f1bc0@arm.com> In-Reply-To: <25828616-1976-6e24-cd7d-a95b789f1bc0@arm.com> From: Xuewen Yan Date: Wed, 10 Nov 2021 13:38:27 +0800 Message-ID: Subject: Re: [Resend PATCH] psi : calc cfs task memstall time more precisely To: Dietmar Eggemann Cc: Zhaoyang Huang , Johannes Weiner , Andrew Morton , Michal Hocko , Vladimir Davydov , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML , Peter Zijlstra , Vincent Guittot , xuewen.yan@unisoc.com, Ke Wang Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A569BB0000B0 X-Stat-Signature: gztyhpqt8pfe473yaj98gijkyueo6at8 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qamOWrHx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of xuewen.yan94@gmail.com designates 209.85.208.180 as permitted sender) smtp.mailfrom=xuewen.yan94@gmail.com X-HE-Tag: 1636522721-796478 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 Tue, Nov 9, 2021 at 8:29 PM Dietmar Eggemann wrote: > > On 08/11/2021 10:20, Zhaoyang Huang wrote: > > On Mon, Nov 8, 2021 at 4:49 PM Xuewen Yan wrote: > >> > >> Hi Dietmar > >> > >> On Sat, Nov 6, 2021 at 1:20 AM Dietmar Eggemann > >> wrote: > >>> > >>> On 05/11/2021 06:58, Zhaoyang Huang wrote: > > [...] > > >>>>> This will let the idle task (swapper) pass. Is this indented? Or do you > >>>>> want to only let CFS tasks (including SCHED_IDLE) pass? > >>>> idle tasks will NOT call psi_memstall_xxx. We just want CFS tasks to > >>>> scale the STALL time. > >>> > >>> Not sure I get this. > >>> > >>> __schedule() -> psi_sched_switch() -> psi_task_change() -> > >>> psi_group_change() -> record_times() -> psi_memtime_fixup() > >>> > >>> is something else than calling psi_memstall_enter() or _leave()? > >>> > >>> IMHO, at least record_times() can be called with current equal > >>> swapper/X. Or is it that PSI_MEM_SOME is never set for the idle task in > >>> this callstack? I don't know the PSI internals. > > According to my understanding, PSI_MEM_SOME represents the CORE's > > state within which there is at least one task trapped in memstall > > path(only counted in by calling PSI_MEMSTALL_ENTER). record_times is > > responsible for collecting the delta time of the CORE since it start. > > What we are doing is to make the delta time more precise. So idle task > > is irrelevant for these. > > Coming back to the original snippet of the patch. > > static unsigned long psi_memtime_fixup(u32 growth) > { > > if (!(current->policy == SCHED_NORMAL || > current->policy == SCHED_BATCH)) > return growth_fixed; > > With this condition: > > (1) you're not bailing when current is the idle task. It has policy > equal 0 (SCHED_NORMAL) > > (2) But you're bailing for a SCHED_IDLE (CFS) task. > > I'm not sure that this is indented here? > > Since you want to do the scaling later based on whats left for CFS tasks > from the CPU capacity my hunch is that you want to rather do: > > if (current->sched_class != &fair_sched_class) > return growth_fixed; Yes, It is the correct method! Thanks! > > What's the possible sched classes of current in psi_memtime_fixup?