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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFF21C282F3 for ; Mon, 12 Jun 2023 13:40:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7354E8E0002; Mon, 12 Jun 2023 09:40:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E4806B0074; Mon, 12 Jun 2023 09:40:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5852D8E0002; Mon, 12 Jun 2023 09:40:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 497D96B0072 for ; Mon, 12 Jun 2023 09:40:34 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 21D8512022E for ; Mon, 12 Jun 2023 13:40:34 +0000 (UTC) X-FDA: 80894205588.23.FA218DE Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf12.hostedemail.com (Postfix) with ESMTP id DFB6740027 for ; Mon, 12 Jun 2023 13:40:31 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=bB2klCXo; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.128.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686577232; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HCfCynw9maP7T2H3b6SF9iHZLNkIpnhfq4BKVNG+mcU=; b=WJgj8102QHzsHXuNFLCy/eDOLnof9zx14Gx4lGG2fO9cvK1Q/ZfV05bez0ItxIwJkkfpCy j3atw5BczZmBXutq4F8hn31Sus8pfM8+Gx1FCD6tBvwlUpZ5+WsIHL4CS4JjvKC4gokF3U 1pynTmQgOyZvGZLksnSjOFmfrH40RAQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=bB2klCXo; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.128.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686577232; a=rsa-sha256; cv=none; b=dz4nyql42VNWD41ze0cbeO45AFIntsBGBtyPhZpzWWN3T9qmh0ntiCiYFVsWaQo1Czo/yj UUl19Aqb/lQj5A4zxQ0ZppxznEkfrKjRO+TOviL6wbJkZKCTtrKjWE/SZTwDMmlmKFnF+k D200EfbLDZuTjgE4ywIHb5hQ7w0z4uw= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-56ce61769b7so26205827b3.3 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=Io9S29YY6+LQ9ZCn3cPUKC44ghaQFxm+doTgUZXy1s7r52nNpBnZlWgLUa//ZWskwo o9jZtviF99MK3cB8UtdGIndCyg6/2pkgghVvGec8DTv/zdk3BV+lRtM3PtH3JtMbaa25 fn2HdX52uGP6OGtw/Y9MP5WMuX6ijwNYVcCv6L36xhDuK9WackTiZqaSbsYVtTn2oekV Z3u3xnU7dm3w+d7j1rPYdixZHmkX4YHhatP6PuboA8RBg8qv7Ctm/1IqgVCHRa419Yg5 kEWb1TxCXtm/T+oYT0M1QR4HyXMkV4ncqHP7fI0WpuHxn0l9xQwnNgJlgnx/hnBEmQ6/ 0LxA== X-Gm-Message-State: AC+VfDz2nuBO4SrLVvnCVK92jd17IisbO2sS0L6pNzaTqusFDsn0x9Lg yrvJ0/uwVxLkQOJZsrOz1bhwUg== X-Google-Smtp-Source: ACHHUZ7QxRcEIS1oGnewylXZV/6b8P1kGCITgoNYLFT1cO0xOtFzTDCoXYpXWh4FwFTUmVk7YcH5wg== 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: DFB6740027 X-Stat-Signature: 49rfqgmb1a8wc8gw8m55ynank41ip1ya X-Rspam-User: X-HE-Tag: 1686577231-903908 X-HE-Meta: U2FsdGVkX18SWbAsgzjOmjzXby2zOBtMiMULowR7cFduT5gHBFECL6cgiLyca24H/PeJucPx1eQwoNC0i6RFmeFQ6lBI+boYzTVmtwdDUc1b2ooaKTFXo6SYPsNws6ka02zALqsgDTM1rIHoyE7lyhERc94NGNfQXzw8OLRgiLO54gx0g7iIiJ79ntbWdU7Xb+w4C6YDtW56AuSz9rbpa8uKiMDfdn+EjfyA2rtBXaL//q00SwxZXVL9hYkeTj7ZhAzyevZwu1MxFljIg4xUL4USFnA9B4oCxIrDNAwv9sdUfz0gJxXxC/8Ny4V3UMtRpRAHLplUt90Bpl/00phcl2C8cnr+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wBExPHqj4B/kTMQH7Ckka3+zXWu6wjR4cwi6hKxxG0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000800, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.