Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5569024rwd; Mon, 12 Jun 2023 06:58:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7tMGCQRZN1IWUEIZIUdUlI5hoCeq4/e7wG6EvIKeAZZSptFSOtPWWEiIrMiXecfckdhFGv X-Received: by 2002:a17:906:fd8d:b0:974:5124:497b with SMTP id xa13-20020a170906fd8d00b009745124497bmr9879147ejb.34.1686578282553; Mon, 12 Jun 2023 06:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686578282; cv=none; d=google.com; s=arc-20160816; b=zy6pt2uBGJzZQLwcI5jtoxf1YR/hjzoGB2fPxeQvE2UkrWWDghR3fQevK66brgCJ2V Ov+OGAF9lhlPTCmGAR8Bi7Q3xH0WQ2i0Jr4U/BfzerewhjGXf0U552GwxH7OX79SCCUM K3tl9V/cmom5TOs4RtLxwmHmhRZbyIOypaRGTMZEpcgkt5VCIBlYoxUYYwGaxIUkjVkY QG5bkbrM9HPPC/a7yMRLy2fX7vkuBBgD+LNDns39zPajXQSXdPcFfptPPyPT62dlhC3P kg1LiNySazrwTrc79N+uMXQFQPnX7GEJQGuMGjNbRVxdE/O8KShidWC8fvND2JHffOBG rqLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HCfCynw9maP7T2H3b6SF9iHZLNkIpnhfq4BKVNG+mcU=; b=iZYznTIGzDXSfX3Q3IujI9xd2s5Zms0gVqd4QL4qsZgwjbty1O0aQUxmP88rLmcdD9 DdEkvWnnY+SeRmb7i8W+rN4e8Ivhw32LwgNFKj+GaorGG4EuHlh15kWlYBhV1fHDk6rE oRgspW/AbsrJ0NadcRK22YZ8T9ghZfoUX1JpAiIWuclU/YKctdSCXWGHJYeEduY29hlH rtQ4zQiYfJ12BZbLVuzrPpY752c7dYO/HEwFRTQY+3hGYqWpCV89yNI1KNWKWrBZT6gt XIeimrk9uvGIPw3wgVKMwOGwsbbU5mPqsF7WubsazW8m1wV4brIbMde3FE4mfAWA9APD BU9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=bB2klCXo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fx17-20020a170906b75100b00974602491b3si5644212ejb.691.2023.06.12.06.57.38; Mon, 12 Jun 2023 06:58:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=bB2klCXo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234589AbjFLNkl (ORCPT + 99 others); Mon, 12 Jun 2023 09:40:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235919AbjFLNkf (ORCPT ); Mon, 12 Jun 2023 09:40:35 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBEA91A1 for ; Mon, 12 Jun 2023 06:40:31 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-56d07c7cf03so19362997b3.1 for ; Mon, 12 Jun 2023 06:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1686577230; x=1689169230; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=HCfCynw9maP7T2H3b6SF9iHZLNkIpnhfq4BKVNG+mcU=; b=bB2klCXowkeQCD7ydffQk/ZCdLueoAPlGFLh0UW/eDaaGUo7U54xEAZK4yPHjSgTHy fQkASPKV8JqwsUTj6YeP7WD+QD5RYptoHZfjRgBGF3LApYvU4ykIQDJ5OIuCCtOCHMq5 6mz41hc1YGWNG/Yp3Qi99kNgEEwNLMiaQ/+Kepo/WYlRYGPcGzff+/PakBWtRxZy+F8m ra5bKyJgpECKcwrxAJUl0AgN6ykHIc16bgYc4J0eF7HyMRg2OavrwALZP/ggHW82C6yF HAr/QxjILfjcgqa750YIgyva/6iRVSX/Wxc5Uqoehb9ACtZpPUtrIWSJNbMwA5Soym3l lJig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686577230; x=1689169230; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HCfCynw9maP7T2H3b6SF9iHZLNkIpnhfq4BKVNG+mcU=; b=hPs4NuGxsd2+MWleBUI2r1fLt6ZMC5OJRm7NmmF8sxwhSUb0iq/v0BMJe+GM2oMcDM pqYlOlzT3vIT6Cq8PHWVxy2URSrxUQjmuTi+1okGOOPcLV/pdZF2qTO6nLEt41tZR1Bs 2/OG+JVJV7XjYhySM/sKTu6XCpNJ36sVdNvLIE1kXiFkVOW9F14f50BpScgTo8vDrX2m Sla9aTYICh7llc11bFvJHnEF8o52pStl//oqWukkYwoUFLztgwQNox/JPr4N8Z7bYcSH Mh0giyTk65BFLK5FhV4c5NqZaMenDJfcVzapG4Fmq92p7dkDT7XFBf3JdORx3GaYrxUT 6FWg== X-Gm-Message-State: AC+VfDyoqbJQjBDI0EKByuRUz5gZFsRfK4idV8jBxsQ637WsUC3rEWD0 52vRrmt/eOBFYPSchGkBda6veA== X-Received: by 2002:a25:cf92:0:b0:bc7:be38:41f2 with SMTP id f140-20020a25cf92000000b00bc7be3841f2mr4941692ybg.49.1686577230740; Mon, 12 Jun 2023 06:40:30 -0700 (PDT) Received: from localhost ([2601:58a:8200:2b0::e699]) by smtp.gmail.com with ESMTPSA id m14-20020a819e0e000000b0055a21492192sm2476446ywj.115.2023.06.12.06.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 06:40:30 -0700 (PDT) Date: Mon, 12 Jun 2023 09:40:28 -0400 From: Johannes Weiner To: Suren Baghdasaryan Cc: Charan Teja Kalla , akpm@linux-foundation.org, minchan@kernel.org, quic_pkondeti@quicinc.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: madvise: fix uneven accounting of psi Message-ID: References: <1685531374-6091-1-git-send-email-quic_charante@quicinc.com> <20230531221955.GD102494@cmpxchg.org> <230e45e8-8cd8-3668-bbfa-a95212b4cb99@quicinc.com> <20230605180013.GD221380@cmpxchg.org> <4543c4e5-43f1-bae2-245e-951437e4bd07@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 09, 2023 at 04:13:14PM -0700, Suren Baghdasaryan wrote: > On Fri, Jun 9, 2023 at 5:42 AM Charan Teja Kalla > wrote: > > > > Thanks Suren & Johannes, > > > > On 6/7/2023 1:18 AM, Suren Baghdasaryan wrote: > > > Hi Folks. Sorry for being late to the party. > > > Yeah, userspace does not have a crystal ball to predict future user > > > behavior, so there will always be pathological cases when usual > > > assumptions and resulting madvise() would make things worse. > > > > > > I think this discussion can be split into several questions/issues: > > > 1. Inconsistency in how madvise(MADV_PAGEOUT) would affect PSI > > > calculation when the page is refaulted, based on the path it took > > > before being evicted by madvise(). In your initial description case > > > (a) is inconsistent with (b) and (c) and it's probably worth fixing. > > > IMHO (a) should be made consistent with others, not the other way > > > around. My reasoning is that page was expelled from the active list, > > > so it was part of the active workingset. > > > > > That means we should be setting Workingset on the page while it is on > > the active list and when it is being pageout through madvising. Right? I > > see, this makes it consistent. > > This was my opinion but others might think otherwise, like I found out > in some recent conversations. So, it would be great to get some more > feedback before making the change. I also agree with the consistency fix: it should set Workingset when madvise zaps pages from the active list.