From: Chris Li <chrisl@kernel.org>
To: YoungJun Park <youngjun.park@lge.com>
Cc: "Michal Koutný" <mkoutny@suse.com>,
akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org,
roman.gushchin@linux.dev, shakeel.butt@linux.dev,
muchun.song@linux.dev, shikemeng@huaweicloud.com,
kasong@tencent.com, nphamcs@gmail.com, bhe@redhat.com,
baohua@kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, gunho.lee@lge.com,
iamjoonsoo.kim@lge.com, taejoon.song@lge.com,
"Matthew Wilcox" <willy@infradead.org>,
"David Hildenbrand" <david@redhat.com>,
"Kairui Song" <ryncsn@gmail.com>, "Wei Xu" <weixugc@google.com>
Subject: Re: [PATCH 1/4] mm/swap, memcg: Introduce infrastructure for cgroup-based swap priority
Date: Sat, 6 Sep 2025 05:56:46 -0700 [thread overview]
Message-ID: <CAF8kJuNW2kmxKYRE9t8WvSOad9JkLYt0WSAcFOQ9r9=2=XGc9Q@mail.gmail.com> (raw)
In-Reply-To: <CAF8kJuPuOWUEMg6C9AnAA-mddgHRjuMVqURrbk6bUHxAmEvgFQ@mail.gmail.com>
On Fri, Sep 5, 2025 at 4:45 PM Chris Li <chrisl@kernel.org> wrote:
> > - Mask computation: precompute at interface write-time vs runtime
> > recomputation. (TBD; preference?)
>
> Let's start with runtime. We can have a runtime and cached with
> generation numbers on the toplevel. Any change will reset the top
> level general number then the next lookup will drop the cache value
> and re-evaluate.
Scratch that cache value idea. I found the run time evaluation can be
very simple and elegant.
Each memcg just needs to store the tier onoff value for the local
swap.tiers operation. Also a mask to indicate which of those tiers
present.
e.g. bits 0-1: default, on bit 0 and off bit 1
bits 2-3: zswap, on bit 2 and off bit3
bits 4-6: first custom tier
...
The evaluation of the current tier "memcg" to the parent with the
default tier shortcut can be:
onoff = memcg->tiers_onoff;
mask = memcg->tiers_mask;
for (p = memcg->parent; p && !has_default(onoff); p = p->parent) {
merge = mask | p->tiers_mask;
new = merge ^ mask;
onoff |= p->tiers_onoff & new;
mask = merge;
}
if (onoff & DEFAULT_OFF) {
// default off, look for the on tiers to turn on
} else {
// default on, look for the off tiers to turn off
}
It is an all bit operation that does not need caching at all. This can
take advantage of the short cut of the default tier. If the default
tier overwrite exists, no need to search the parent further.
Chris
next prev parent reply other threads:[~2025-09-06 12:57 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 20:20 [PATCH 0/4] mm/swap, memcg: Support per-cgroup swap device priorities Youngjun Park
2025-07-16 20:20 ` [PATCH 1/4] mm/swap, memcg: Introduce infrastructure for cgroup-based swap priority Youngjun Park
2025-07-17 11:20 ` kernel test robot
2025-07-22 14:09 ` YoungJun Park
2025-07-18 17:08 ` kernel test robot
2025-07-22 14:11 ` YoungJun Park
2025-07-21 15:13 ` kernel test robot
2025-07-22 14:14 ` YoungJun Park
2025-07-22 8:41 ` Michal Koutný
2025-07-22 14:05 ` YoungJun Park
2025-07-22 18:41 ` YoungJun Park
2025-08-14 14:03 ` Michal Koutný
2025-08-15 15:10 ` Chris Li
2025-08-16 17:21 ` YoungJun Park
2025-08-16 19:15 ` Chris Li
2025-08-19 10:12 ` YoungJun Park
2025-08-20 0:52 ` Chris Li
2025-08-20 14:39 ` YoungJun Park
2025-08-21 20:39 ` Chris Li
2025-08-22 5:45 ` YoungJun Park
2025-08-22 16:48 ` Chris Li
2025-08-24 14:19 ` YoungJun Park
[not found] ` <aKsAES4cXWbDG1xn@yjaykim-PowerEdge-T330>
2025-08-26 8:19 ` Chris Li
2025-08-26 12:57 ` YoungJun Park
2025-08-26 14:30 ` Chris Li
2025-08-30 4:05 ` YoungJun Park
2025-08-30 7:13 ` Chris Li
2025-08-31 13:53 ` YoungJun Park
2025-08-31 16:45 ` Chris Li
2025-09-01 16:03 ` YoungJun Park
2025-09-01 16:06 ` YoungJun Park
2025-09-01 22:40 ` Chris Li
2025-09-03 9:32 ` Chris Li
2025-09-03 10:18 ` YoungJun Park
2025-09-05 6:30 ` YoungJun Park
2025-09-05 23:45 ` Chris Li
2025-09-06 12:56 ` Chris Li [this message]
2025-09-07 17:51 ` YoungJun Park
2025-09-10 0:26 ` Chris Li
2025-09-07 17:39 ` YoungJun Park
2025-09-10 0:14 ` Chris Li
2025-09-12 15:39 ` YoungJun Park
2025-08-16 16:41 ` YoungJun Park
2025-07-16 20:20 ` [PATCH 2/4] mm: swap: Apply per-cgroup swap priority mechanism to swap layer Youngjun Park
2025-07-16 20:20 ` [PATCH 3/4] mm: memcg: Add swap cgroup priority inheritance mechanism Youngjun Park
2025-07-16 20:20 ` [PATCH 4/4] mm: swap: Per-cgroup per-CPU swap device cache with shared clusters Youngjun Park
2025-07-22 17:44 ` Kairui Song
2025-07-22 18:30 ` 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='CAF8kJuNW2kmxKYRE9t8WvSOad9JkLYt0WSAcFOQ9r9=2=XGc9Q@mail.gmail.com' \
--to=chrisl@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=bhe@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=david@redhat.com \
--cc=gunho.lee@lge.com \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mkoutny@suse.com \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=roman.gushchin@linux.dev \
--cc=ryncsn@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=shikemeng@huaweicloud.com \
--cc=taejoon.song@lge.com \
--cc=weixugc@google.com \
--cc=willy@infradead.org \
--cc=youngjun.park@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