Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp85248pxh; Tue, 9 Nov 2021 21:43:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcFvTwRXRZcOHkdDp4j/Pkinqi9f/+lRVV07ny2Iny/1nd3Tqz0tTiDLugCo3dRnd03THd X-Received: by 2002:a05:6402:354c:: with SMTP id f12mr18179139edd.108.1636523016591; Tue, 09 Nov 2021 21:43:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636523016; cv=none; d=google.com; s=arc-20160816; b=n0INtnJjEa6zZQJrwASrQoswgTIYSpIYF2KReEYlkd34hYkp+HBx3D46+s8r3p9q7l n5700LyC8DG5CMrLQY+JCG0pI3yK0YVoAUucgsOqvi924X2WidluydgLv9AbUp8/aINF RaBdUs8J3dbq4uFcsWj+NQHe16BXhK23fPXpdycLtS4JZc2sMrdKpMLjxz/bJ0GtZj5q 9KREoHLr3kCi8/NKW6yfAmmapnGqb2UEijlBWL7Z5urBM3EPlZfgGLiBMOcPwJAlJ0L9 qj8GZsCKySO9qdgGd+awCU+wcfkAcb/bo2q3MI0xbggSG1AZYS29K0hXBX8tkXiCBpa+ sADA== 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=fDtvbV5LxV5z9R4yo8jwMsLWShI2ssXYnCOglSG/Vk8=; b=G6zx3PGcf7z/5j9Dv00pWcJaeIbhGTIPSMcZ6K8rMvGy9D1B/6BbtpVeLipJRSGsof +CL0LW6PjgGfCWrL1KOdavbCtIb035AunkFH2wfWugepb6P6/oVcNhhDPWgPd9y5pUSt LF4a3Qb52RxTrjMfOspaRc6VbDt4mbBFvZIzjLju9H2A24/s3nW0gVg5k4x1bWyEsqd3 0kf/eFzbFl1EwF8sJ66rzxtsarfLmjSr4meFI0hiGHnNGNUDz4jSzQLV89M52LKuFwRx qd32ObHq3dfeURwOB8Ju1UuaS3DhnZK9kY8Be+OUjS9nk2fYyNo4cRIvJ9zf+CjBB7lN AZzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qamOWrHx; 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 sg20si23636759ejc.90.2021.11.09.21.43.00; Tue, 09 Nov 2021 21:43:36 -0800 (PST) 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=qamOWrHx; 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 S229572AbhKJFlb (ORCPT + 99 others); Wed, 10 Nov 2021 00:41:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbhKJFl3 (ORCPT ); Wed, 10 Nov 2021 00:41:29 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07A6EC061764 for ; Tue, 9 Nov 2021 21:38:42 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id e9so3002593ljl.5 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=F+OIAII8Zpc8GYZYWtGEy5qqfALBaU06JenkSrWNfJMlPEbO+TH2AyAASlQ6NNyE2d sgg802if8jhllCW02wfEbYSnlyFr3067+5OhZc+k4J/rVMXkhCXKS42F823kP+zoXjbW yYMOxT9BbVAZAz8Yyk6ul+1TawS0z3KNaqFfLJukPLsvL186VvNJMwv0z5IuxPmkH/5c fZThPe6SR7T1L9pTkBkKph4jAghzwtSmFzzKqucV2WRx6XGdSbYLGwjMFWD/mcmpK1aM fZGcBq3qNeylkBoAxSWSUVBmA1K7/oT+M1F+wmiZsmV58wwVNUBQ8Bmj9dqly/R1gYdg fmTg== X-Gm-Message-State: AOAM532F8OBscSwAVda9pz2A91s9ZnAK1J+AFPFSPRULi/x8YaPJoqjO QsNPtGP47GctsFgXdE69s2WWBokSjcWWP1x02wY= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?