linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nhat Pham <nphamcs@gmail.com>
To: "Sridhar, Kanchana P" <kanchana.p.sridhar@intel.com>
Cc: "Huang, Ying" <ying.huang@intel.com>,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	 "hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"yosryahmed@google.com" <yosryahmed@google.com>,
	 "ryan.roberts@arm.com" <ryan.roberts@arm.com>,
	"21cnbao@gmail.com" <21cnbao@gmail.com>,
	 "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"Zou, Nanhai" <nanhai.zou@intel.com>,
	 "Feghali, Wajdi K" <wajdi.k.feghali@intel.com>,
	"Gopal, Vinodh" <vinodh.gopal@intel.com>
Subject: Re: [PATCH v4 0/4] mm: ZSWAP swap-out of mTHP folios
Date: Tue, 20 Aug 2024 17:13:39 -0400	[thread overview]
Message-ID: <CAKEwX=P8o+hLsdQw_xKymgteLXsBPfDf4kGVKdgE=PNj=b0cMw@mail.gmail.com> (raw)
In-Reply-To: <SJ0PR11MB56784DD616B595FC707E5133C98D2@SJ0PR11MB5678.namprd11.prod.outlook.com>

On Mon, Aug 19, 2024 at 11:01 PM Sridhar, Kanchana P
<kanchana.p.sridhar@intel.com> wrote:
>
> Hi Ying,
>
> I confirmed that in the case of usemem, all calls to [1] occur from the code path in [3].
> However, my takeaway from this is that the more reclaim that results in zswap_store(),
> for e.g., from mTHP folios, there is higher likelihood of overage recorded per-process in
> current->memcg_nr_pages_over_high, which could potentially be causing each
> process to reclaim memory, even if it is possible that the swapout from a few of
> the 70 processes could have brought the parent cgroup under the limit.

Yeah IIUC, the memory increase from zswap store happens
immediately/synchronously (swap_writepage() -> zswap_store() ->
obj_cgroup_charge_zswap()), before the memory saving kicks in. This is
a non-issue for swap - the memory saving doesn't happen right away,
but it also doesn't increase memory usage (well, as you pointed out,
obj_cgroup_charge_zswap() doesn't even happen).

And yes, this is compounded a) if you're in a high concurrency regime,
where all tasks in the same cgroup, under memory pressure, all go into
reclaim. and b) for larger folios, where we compress multiple pages
before the saving happens. I wonder how bad the effect is tho - could
you quantify the reclamation amount that happens per zswap store
somehow with tracing magic?

Also, I wonder if there is a "charge delta" mechanism, where we
directly uncharge by (page size - zswap object size), to avoid the
temporary double charging... Sort of like what folio migration is
doing now v.s what it used to do. Seems complicated - not even sure if
it's possible TBH.

>
> Please do let me know if you have any other questions. Appreciate your feedback
> and comments.
>
> Thanks,
> Kanchana


  reply	other threads:[~2024-08-20 21:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19  2:16 Kanchana P Sridhar
2024-08-19  2:16 ` [PATCH v4 1/4] mm: zswap: zswap_is_folio_same_filled() takes an index in the folio Kanchana P Sridhar
2024-08-19  2:16 ` [PATCH v4 2/4] mm: zswap: zswap_store() extended to handle mTHP folios Kanchana P Sridhar
2024-08-20 20:03   ` Sridhar, Kanchana P
2024-08-19  2:16 ` [PATCH v4 3/4] mm: Add MTHP_STAT_ZSWPOUT to sysfs per-order mthp stats Kanchana P Sridhar
2024-08-19  2:16 ` [PATCH v4 4/4] mm: swap: Count successful mTHP ZSWAP stores in sysfs mTHP stats Kanchana P Sridhar
2024-08-19  3:16 ` [PATCH v4 0/4] mm: ZSWAP swap-out of mTHP folios Huang, Ying
2024-08-19  5:12   ` Sridhar, Kanchana P
2024-08-19  5:51     ` Huang, Ying
2024-08-20  3:00       ` Sridhar, Kanchana P
2024-08-20 21:13         ` Nhat Pham [this message]
2024-08-20 22:09           ` Sridhar, Kanchana P
2024-08-21 14:42 ` Nhat Pham
2024-08-21 19:07   ` Sridhar, Kanchana P
2024-08-24  6:21     ` Sridhar, Kanchana P
2024-08-26 14:12       ` Nhat Pham
2024-08-27  6:08         ` Sridhar, Kanchana P
2024-08-27 15:23           ` Nhat Pham
2024-08-27 15:30             ` Nhat Pham
2024-08-27 18:43               ` Sridhar, Kanchana P
2024-08-28  7:27                 ` Sridhar, Kanchana P
2024-08-27 18:42             ` Sridhar, Kanchana P
2024-08-28  7:24               ` Sridhar, Kanchana P
2024-08-28  7:43                 ` Yosry Ahmed
2024-08-28 18:50                   ` Sridhar, Kanchana P
2024-08-28 22:34                     ` Yosry Ahmed
2024-08-29  0:14                       ` Sridhar, Kanchana P
2024-08-24  3:09   ` Yosry Ahmed
2024-08-24  6:24     ` Sridhar, Kanchana P
2024-08-27 14:55 ` Nhat Pham
2024-08-27 18:09   ` Sridhar, Kanchana P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKEwX=P8o+hLsdQw_xKymgteLXsBPfDf4kGVKdgE=PNj=b0cMw@mail.gmail.com' \
    --to=nphamcs@gmail.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kanchana.p.sridhar@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nanhai.zou@intel.com \
    --cc=ryan.roberts@arm.com \
    --cc=vinodh.gopal@intel.com \
    --cc=wajdi.k.feghali@intel.com \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox