Docs/mm/damon/design: describe the differences for pageout's virtual address and physcial address
Message ID | 20240224215023.5271-1-21cnbao@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-79880-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1331543dyb; Sat, 24 Feb 2024 13:50:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU0KZm4VrAyfZBMJgcWCE059O2VKMEzECCGReC/y3Yh4XJRYr9Fg267ZkFqg2Ap+Ts4z9M/Cr5Xtj5OxP0XWKPumdX3zQ== X-Google-Smtp-Source: AGHT+IGdw1JwC28aaJ1P4jWexOmbB77gDowNs+2Kt7eLHUrLjTqOnuWXmjEpflrDXrUj7y7vecOG X-Received: by 2002:a0c:d990:0:b0:68f:f0ce:3618 with SMTP id y16-20020a0cd990000000b0068ff0ce3618mr1537308qvj.27.1708811456119; Sat, 24 Feb 2024 13:50:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708811456; cv=pass; d=google.com; s=arc-20160816; b=baBl9HrDGxItGADqB6j0KELte18BzxDb1zTnp7r+dAliLSV+pkZUXD+zADCH0tsSqM 8eUbudCUZxx40bCucggR+YoBmujyQ7K12MSECUmR305xgzM76Aunz1jF8uhQUa+VImXs Zh4nHmIf0H+3yeFd0rrJ43/X0bObAlioBeAbLZOqvQm4HbaQF9nNhMvVwU1+iQ/Rw1jf VOQIxPqbiAm+Qytv/iAluHRhCB4xesFQSyN5+1lSGHMwvcBOnPcX0sOvwhdFKfWT4uYz qFNYZ49lRMUQL0UuORLx4Dwm/cLGIFSsSfsy1sn4LWlwmg3QM9lE0ysrnNYODUwMbne8 TNCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ydh9YpZ5plBfJp+BJ1ZlCj0CTUl0s4YGZgmpPJqLx+E=; fh=o/oVzkei4V3d3ql05rfU/LQmxA1ALMWpzdEP89J40MA=; b=cAz3kZF5QE/KXwmycKIL04tDSn1eBn6mgenhoV+6szyH1k1o+UrieB1QiG4glJRyQu Wp5Wy7rIrVYakcDEjep14IaDZ6d7ml/I0PfUK5RcpCdPg0cfLRXcTHGIcj+S8uB4V7bG rh/pxQC7chuaF9ct67iyJv9idAPc8B+VQ3gM9SkQE48pb3J3s4Aa2eZf0q7BGaPNHQ1S YUMD1GT03I7/xSO/YsXM4S8m1kRU2pAGHV6LoIef1Hv84WRspnEf9SN62H/lt7dqYERC K6vgrNLBWRpd4WrJUkX1eE0si4rcouDgmO7JFVr84lp6tKQxKnJCnL4AR/pBFAKLjLbh BgXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TXycU5pK; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79880-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79880-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gv3-20020a056214262300b0068cb0aa2ec6si1935996qvb.518.2024.02.24.13.50.56 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 13:50:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79880-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TXycU5pK; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79880-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79880-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E29181C20F79 for <ouuuleilei@gmail.com>; Sat, 24 Feb 2024 21:50:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF6C74D9E7; Sat, 24 Feb 2024 21:50:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TXycU5pK" Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCFF54317B; Sat, 24 Feb 2024 21:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708811443; cv=none; b=C6VOuARGVJBrUiD1MqhDehyZOjLYwubPYrQvZXv66//sd4HgeZLeTvfsqVIevAdKUeLPmjqDXl0n2LPCBGNWIRo8zCnczfxZfRgSjQZ7wp9X0o14b/Nq4JTRGjVFM/SJ1mNgYAyciTJxj1zqlyBNyoYLbNeV6gK/sOzYkybI3iM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708811443; c=relaxed/simple; bh=4BPgwLpKQTq/0vxcQXG57XBxOy8tRWhOr/7YSpHpNIM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=rb6iGGb0plh92Sl6GZ5/+XL9XZlgETMBvgT7r2pXEgIlUqaWAVPFUGcn5Mk6Nk+5J4SrYOdjqQ0BYG0M2CtHVCPFrQYl0dmVvdnT8niUlC/pgjjUX95O9gw2/T4ySmHGaHfnMS9axvzbleb981q9+Mtkfl3RYTc8fwhPPfo60Dg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TXycU5pK; arc=none smtp.client-ip=209.85.210.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6e48e42a350so478054a34.1; Sat, 24 Feb 2024 13:50:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708811441; x=1709416241; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ydh9YpZ5plBfJp+BJ1ZlCj0CTUl0s4YGZgmpPJqLx+E=; b=TXycU5pKDv/TsuTt59MUGQfQpxXtqiaJGkmVKq6wBP7k9ouN5muAJf0fYHHqilQIZ6 JeJL8IW7zYfLAETQX9yqFYDQYqAgpCpUY3/CDM6g24jFotZaXJL05se37zLtAqUq8REy ZrnBvZzT8i97q12CXWv/QxE+aM9ndQfgs4zo5NGlZvvx0TFf15NGGjk9Yc7TmRBtQ+rm wxwPrnauDqXEUuZ9eZ4SGHPnLV5xQRFwujFRf3IwX4YtXY6W8zw9XkgjW8y63uKQUzur 0HxTp4NI8C33s1rg4Ace3x/Jc2ekuBqXzD5dZexpPssVHvm3PmvSkjh8mrCIev9umZOi mXQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708811441; x=1709416241; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ydh9YpZ5plBfJp+BJ1ZlCj0CTUl0s4YGZgmpPJqLx+E=; b=wBroVYs8X6nnhtnGFiTOlP91DxuE4WHZXnlH0kNIb4Xa78g+F/q6J4I8+33a2CrZJr SfTXzfOwgRou68o8qMz8j5kyFaJGRjbug1pqwgNEVxcpebiS9VzzT8WtF6dCK4k6vbuA V8nW4B7E1drD7B2hpS9Y8p/jChbw+RWNQC1aZIQLp+Pti7vQEQZOf8T6Oh3z/tHmzOcp zr6lfcMo7VKWLSM2FThJ5yq4JysbjzE/mDtYhYpODybro9tyI/Og9nJWXFzQgxZVjYDs LeErN5VuSnTuZVTjO46fC9G9gF9drKbe4u58RRnvnhzAslzHBNrPBXgsQNTCYk3IqJf6 kKPQ== X-Forwarded-Encrypted: i=1; AJvYcCV9ZbrwYx5xtjn81JuDKFyL4mopX+//bBx5yfKNyZ3gaOsgyzAss73Oe2NvBLqTb32PUlXKRFk42gv2OtqW7aHGu4Fopg2+j/A8 X-Gm-Message-State: AOJu0YwN9MsOzGhFMnjJhboweCQwbAEsBgVcjsvWjyslULW8dQkGCLEe v9GQNnrYhDg7RwmoqYMBwMBluCzOaXUbFwfzWLcStY3e0PaLIhOp X-Received: by 2002:a05:6830:4414:b0:6e4:82a4:742e with SMTP id q20-20020a056830441400b006e482a4742emr4515589otv.0.1708811440809; Sat, 24 Feb 2024 13:50:40 -0800 (PST) Received: from barry-desktop.hub ([2407:7000:8942:5500:fae4:3bff:fecb:410]) by smtp.gmail.com with ESMTPSA id du15-20020a056a002b4f00b006e4bcdcff43sm1509866pfb.78.2024.02.24.13.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 13:50:40 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: corbet@lwn.net, linux-mm@kvack.org, akpm@linux-foundation.org, damon@lists.linux.dev, linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>, SeongJae Park <sj@kernel.org>, Minchan Kim <minchan@kernel.org>, Michal Hocko <mhocko@suse.com>, Johannes Weiner <hannes@cmpxchg.org> Subject: [PATCH] Docs/mm/damon/design: describe the differences for pageout's virtual address and physcial address Date: Sun, 25 Feb 2024 10:50:23 +1300 Message-Id: <20240224215023.5271-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791818681378358747 X-GMAIL-MSGID: 1791818681378358747 |
Series |
Docs/mm/damon/design: describe the differences for pageout's virtual address and physcial address
|
|
Commit Message
Barry Song
Feb. 24, 2024, 9:50 p.m. UTC
From: Barry Song <v-songbaohua@oppo.com> The doc needs update. As only in the case of virtual address, we are calling madvise() with MADV_PAGEOUT; but in the case of physical address, we are actually calling reclaim_pages() directly. And madvise() with MADV_PAGEOUT is much more aggresive on reclamation compared to reclaim_pages() on paddr. Cc: SeongJae Park <sj@kernel.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Barry Song <v-songbaohua@oppo.com> --- Documentation/mm/damon/design.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Comments
Hi Barry, On Sun, 25 Feb 2024 10:50:23 +1300 Barry Song <21cnbao@gmail.com> wrote: > From: Barry Song <v-songbaohua@oppo.com> > > The doc needs update. As only in the case of virtual address, we are > calling madvise() with MADV_PAGEOUT; but in the case of physical > address, we are actually calling reclaim_pages() directly. And > madvise() with MADV_PAGEOUT is much more aggresive on reclamation > compared to reclaim_pages() on paddr. Thank you for this nice patch :) > > Cc: SeongJae Park <sj@kernel.org> > Cc: Minchan Kim <minchan@kernel.org> > Cc: Michal Hocko <mhocko@suse.com> > Cc: Johannes Weiner <hannes@cmpxchg.org> > Signed-off-by: Barry Song <v-songbaohua@oppo.com> > --- > Documentation/mm/damon/design.rst | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst > index 8c89d26f0baa..6c50743552f5 100644 > --- a/Documentation/mm/damon/design.rst > +++ b/Documentation/mm/damon/design.rst > @@ -315,7 +315,13 @@ that supports each action are as below. > Supported by ``vaddr`` and ``fvaddr`` operations set. > - ``cold``: Call ``madvise()`` for the region with ``MADV_COLD``. > Supported by ``vaddr`` and ``fvaddr`` operations set. > - - ``pageout``: Call ``madvise()`` for the region with ``MADV_PAGEOUT``. > + - ``pageout``: Call ``madvise()`` for the region with ``MADV_PAGEOUT`` if > + the region is using virtual address; otherwise, call ``reclaim_pages()`` > + for the region if physical address is used. > + ``madvise()`` with ``MADV_PAGEOUT`` is aggressively reclaiming memory > + when pages are not shared by multiple processes. Differently, paddr's > + pageout will do the best-effort reclamation by scanning PTEs to figure > + out if pages are young, if not, pages are reclaimed. I think this might be too much details. Especially, explanation of ``MADV_PAGEOUT`` might better to be done on it's document. We wouldn't want to update two places for future changes to ``MADV_PAGEOUT``. What do you think about making it simple and independent from the implementation detail? For example, - - ``pageout``: Call ``madvise()`` for the region with ``MADV_PAGEOUT``. + - ``pageout``: Reclaim the region. Thanks, SJ > Supported by ``vaddr``, ``fvaddr`` and ``paddr`` operations set. > - ``hugepage``: Call ``madvise()`` for the region with ``MADV_HUGEPAGE``. > Supported by ``vaddr`` and ``fvaddr`` operations set. > -- > 2.34.1
On Sun, Feb 25, 2024 at 11:08 AM SeongJae Park <sj@kernel.org> wrote: > > Hi Barry, > > On Sun, 25 Feb 2024 10:50:23 +1300 Barry Song <21cnbao@gmail.com> wrote: > > > From: Barry Song <v-songbaohua@oppo.com> > > > > The doc needs update. As only in the case of virtual address, we are > > calling madvise() with MADV_PAGEOUT; but in the case of physical > > address, we are actually calling reclaim_pages() directly. And > > madvise() with MADV_PAGEOUT is much more aggresive on reclamation > > compared to reclaim_pages() on paddr. > > Thank you for this nice patch :) > > > > > Cc: SeongJae Park <sj@kernel.org> > > Cc: Minchan Kim <minchan@kernel.org> > > Cc: Michal Hocko <mhocko@suse.com> > > Cc: Johannes Weiner <hannes@cmpxchg.org> > > Signed-off-by: Barry Song <v-songbaohua@oppo.com> > > --- > > Documentation/mm/damon/design.rst | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst > > index 8c89d26f0baa..6c50743552f5 100644 > > --- a/Documentation/mm/damon/design.rst > > +++ b/Documentation/mm/damon/design.rst > > @@ -315,7 +315,13 @@ that supports each action are as below. > > Supported by ``vaddr`` and ``fvaddr`` operations set. > > - ``cold``: Call ``madvise()`` for the region with ``MADV_COLD``. > > Supported by ``vaddr`` and ``fvaddr`` operations set. > > - - ``pageout``: Call ``madvise()`` for the region with ``MADV_PAGEOUT``. > > + - ``pageout``: Call ``madvise()`` for the region with ``MADV_PAGEOUT`` if > > + the region is using virtual address; otherwise, call ``reclaim_pages()`` > > + for the region if physical address is used. > > + ``madvise()`` with ``MADV_PAGEOUT`` is aggressively reclaiming memory > > + when pages are not shared by multiple processes. Differently, paddr's > > + pageout will do the best-effort reclamation by scanning PTEs to figure > > + out if pages are young, if not, pages are reclaimed. > > I think this might be too much details. Especially, explanation of > ``MADV_PAGEOUT`` might better to be done on it's document. We wouldn't want to > update two places for future changes to ``MADV_PAGEOUT``. What do you think > about making it simple and independent from the implementation detail? For > example, > > - - ``pageout``: Call ``madvise()`` for the region with ``MADV_PAGEOUT``. > + - ``pageout``: Reclaim the region. make sense. as someday we might rename reclaim_pages to reclaim_folios or something else. and we might not use madvise() for vaddr any more, who knows:-) so it is more sensible to remove the details. I will send v2 to follow your proposal. > > Thanks, > SJ > > > Supported by ``vaddr``, ``fvaddr`` and ``paddr`` operations set. > > - ``hugepage``: Call ``madvise()`` for the region with ``MADV_HUGEPAGE``. > > Supported by ``vaddr`` and ``fvaddr`` operations set. > > -- > > 2.34.1 Thanks Barry
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 8c89d26f0baa..6c50743552f5 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -315,7 +315,13 @@ that supports each action are as below. Supported by ``vaddr`` and ``fvaddr`` operations set. - ``cold``: Call ``madvise()`` for the region with ``MADV_COLD``. Supported by ``vaddr`` and ``fvaddr`` operations set. - - ``pageout``: Call ``madvise()`` for the region with ``MADV_PAGEOUT``. + - ``pageout``: Call ``madvise()`` for the region with ``MADV_PAGEOUT`` if + the region is using virtual address; otherwise, call ``reclaim_pages()`` + for the region if physical address is used. + ``madvise()`` with ``MADV_PAGEOUT`` is aggressively reclaiming memory + when pages are not shared by multiple processes. Differently, paddr's + pageout will do the best-effort reclamation by scanning PTEs to figure + out if pages are young, if not, pages are reclaimed. Supported by ``vaddr``, ``fvaddr`` and ``paddr`` operations set. - ``hugepage``: Call ``madvise()`` for the region with ``MADV_HUGEPAGE``. Supported by ``vaddr`` and ``fvaddr`` operations set.