Linux cgroups development
 help / color / mirror / Atom feed
From: YoungJun Park <youngjun.park@lge.com>
To: Nhat Pham <nphamcs@gmail.com>
Cc: akpm@linux-foundation.org, chrisl@kernel.org, linux-mm@kvack.org,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	kasong@tencent.com, hannes@cmpxchg.org, mhocko@kernel.org,
	roman.gushchin@linux.dev, shakeel.butt@linux.dev,
	muchun.song@linux.dev, shikemeng@huaweicloud.com,
	baoquan.he@linux.dev, baohua@kernel.org, gunho.lee@lge.com,
	taejoon.song@lge.com, hyungjun.cho@lge.com, mkoutny@suse.com,
	baver.bae@lge.com, matia.kim@lge.com
Subject: Re: [PATCH v7 4/4] mm: swap: filter swap allocation by memcg tier mask
Date: Mon, 1 Jun 2026 12:50:21 +0900	[thread overview]
Message-ID: <ah0BfRFv285gWph8@yjaykim-PowerEdge-T330> (raw)
In-Reply-To: <CAKEwX=N2XcMHN1jatppOk6wnmz-Shab5XMtTtzgYOzRvU_6YFw@mail.gmail.com>

On Sat, May 30, 2026 at 11:21:12AM -0700, Nhat Pham wrote:
> On Sat, May 30, 2026 at 10:51 AM Nhat Pham <nphamcs@gmail.com> wrote:
> >
> >
> > How expensive is it to add per-cpu caching for each device :(
> 
> to clarify - a percpu_swap_cluster per si for every si.
> 
> >
> 
> ... or for each tier (assuming devices in each tier share the same
> performance characteristics, and could be used interchangeably?).
> 
> Basically:
> 
> struct percpu_swap_cluster {
>     struct swap_info_struct *si[MAX_SWAPTIER][SWAP_NR_ORDERS];
>     unsigned long offset[MAX_SWAPTIER][SWAP_NR_ORDERS];
>     local_lock_t lock;
> };
> 
> Seems like 4 is the default number of tier right? So the extra
> overhead is just (nr cpu) * 10 * 3 * (sizeof(unsigned long) +
> sizeof(*ptr)) or wev?

I agree. I actually considered the idea of a tier-centric cache as well.

You might remember that in the previous "per cgroup swap priority"
patchset, I implemented per-cpu caches per priority, which is essentially
the same as having them per tier.

However, as you agreed in another thread, including this optimization
right now might be a bit premature. If the core swap tier idea gets
merged, I plan to explore this optimization further as follow-up work.

Thanks
Youngjun Park

  reply	other threads:[~2026-06-01  3:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27  6:22 [PATCH v7 0/4] mm: swap: introduce swap tier infrastructure Youngjun Park
2026-05-27  6:22 ` [PATCH v7 1/4] " Youngjun Park
2026-05-27  6:22 ` [PATCH v7 2/4] mm: swap: associate swap devices with tiers Youngjun Park
2026-05-27  6:22 ` [PATCH v7 3/4] mm: memcontrol: add interfaces for swap tier selection Youngjun Park
2026-05-27  6:22 ` [PATCH v7 4/4] mm: swap: filter swap allocation by memcg tier mask Youngjun Park
2026-05-27  7:32   ` Baoquan He
2026-05-30 17:51   ` Nhat Pham
2026-05-30 18:21     ` Nhat Pham
2026-06-01  3:50       ` YoungJun Park [this message]
2026-05-27 20:36 ` [PATCH v7 0/4] mm: swap: introduce swap tier infrastructure Andrew Morton
2026-05-27 23:52   ` Yosry Ahmed
2026-06-01  4:00   ` YoungJun Park
2026-05-30 18:02 ` Nhat Pham
2026-06-01  3:42   ` YoungJun Park

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=ah0BfRFv285gWph8@yjaykim-PowerEdge-T330 \
    --to=youngjun.park@lge.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baoquan.he@linux.dev \
    --cc=baver.bae@lge.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chrisl@kernel.org \
    --cc=gunho.lee@lge.com \
    --cc=hannes@cmpxchg.org \
    --cc=hyungjun.cho@lge.com \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=matia.kim@lge.com \
    --cc=mhocko@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=shikemeng@huaweicloud.com \
    --cc=taejoon.song@lge.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