From: Chengming Zhou <zhouchengming@bytedance.com>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Seth Jennings <sjenning@redhat.com>,
Dan Streetman <ddstreet@ieee.org>, Chris Li <chriscli@google.com>,
Nhat Pham <nphamcs@gmail.com>,
Vitaly Wool <vitaly.wool@konsulko.com>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Chris Li <chrisl@kernel.org>
Subject: Re: [PATCH v2 6/6] mm/zswap: directly use percpu mutex and buffer in load/store
Date: Mon, 18 Dec 2023 19:26:47 +0800 [thread overview]
Message-ID: <c53eb450-ebce-4ac3-91cd-59d5ae44d702@bytedance.com> (raw)
In-Reply-To: <CAJD7tkZSrd-R-vuVqh29fgZ6bmo3EJxdb2Eahm0Ozg5hkPEjRg@mail.gmail.com>
On 2023/12/18 17:37, Yosry Ahmed wrote:
> On Mon, Dec 18, 2023 at 12:22 AM Chengming Zhou
> <zhouchengming@bytedance.com> wrote:
>>
>> Since the introduce of reusing the dstmem in the load path, it seems
>> confusing that we are now using acomp_ctx->dstmem and acomp_ctx->mutex
>> now for purposes other than what the naming suggests.
>>
>> Yosry suggested removing these two fields from acomp_ctx, and directly
>> using zswap_dstmem and zswap_mutex in both the load and store paths,
>> rename them, and add proper comments above their definitions that they
>> are for generic percpu buffering on the load and store paths.
>>
>> So this patch remove dstmem and mutex from acomp_ctx, and rename the
>> zswap_dstmem to zswap_buffer, using the percpu mutex and buffer on
>> the load and store paths. And refactor out __zswap_store() to only
>> include the compress & store, since I found zswap_store() is too long.
>
> I am not sure refactoring out __zswap_store() is useful to be honest,
> but I am not objecting to it, it mirrors __zswap_load() in a sense.
Yes, it mirrors __zswap_load() and only includes compress and store.
And it makes easy for me to only concentrate on __zswap_store/load()
when renaming the percpu buffers and mutex. But if anyone has objection,
I can drop it.
> However, if you want to do so, please do it in a separate patch from
> renaming the percpu buffers and mutex. This will make reviewing easier
> (and make my Suggested-by correctly scoped).
Right, will do.
>
> Also, any reason why raw_smp_processor_id() is used here instead of
> smp_processor_id()?
>
Here we don't need the CPU id stable, since we only need to pick one
CPU and use the mutex to serialize.
And from the comments below in <include/linux/smp.h>, WARN would happen
if we use smp_processor_id() here without other helpers.
* The CPU id is stable when:
*
* - IRQs are disabled;
* - preemption is disabled;
* - the task is CPU affine.
* When CONFIG_DEBUG_PREEMPT; we verify these assumption and WARN
* when smp_processor_id() is used when the CPU id is not stable.
Thanks!
next prev parent reply other threads:[~2023-12-18 11:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 8:21 [PATCH v2 0/6] mm/zswap: dstmem reuse optimizations and cleanups Chengming Zhou
2023-12-18 8:22 ` [PATCH v2 1/6] mm/zswap: change dstmem size to one page Chengming Zhou
2023-12-19 11:56 ` Chris Li
2023-12-18 8:22 ` [PATCH v2 2/6] mm/zswap: reuse dstmem when decompress Chengming Zhou
2023-12-18 9:24 ` Yosry Ahmed
2023-12-18 8:22 ` [PATCH v2 3/6] mm/zswap: refactor out __zswap_load() Chengming Zhou
2023-12-18 8:22 ` [PATCH v2 4/6] mm/zswap: cleanup zswap_load() Chengming Zhou
2023-12-18 8:22 ` [PATCH v2 5/6] mm/zswap: cleanup zswap_writeback_entry() Chengming Zhou
2023-12-18 8:22 ` [PATCH v2 6/6] mm/zswap: directly use percpu mutex and buffer in load/store Chengming Zhou
2023-12-18 9:37 ` Yosry Ahmed
2023-12-18 11:26 ` Chengming Zhou [this message]
2023-12-18 11:54 ` Chengming Zhou
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=c53eb450-ebce-4ac3-91cd-59d5ae44d702@bytedance.com \
--to=zhouchengming@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=chriscli@google.com \
--cc=chrisl@kernel.org \
--cc=ddstreet@ieee.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=sjenning@redhat.com \
--cc=vitaly.wool@konsulko.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