From: David Hildenbrand <david@redhat.com>
To: alexs@kernel.org, Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
willy@infradead.org, izik.eidus@ravellosystems.com
Subject: Re: [PATCH 3/4] mm/ksm: rename mm_slot_cache to ksm_slot_cache
Date: Tue, 30 Apr 2024 14:57:05 +0200 [thread overview]
Message-ID: <2e074a0b-7ab6-4381-9216-31f68a738a07@redhat.com> (raw)
In-Reply-To: <20240428100619.3332036-3-alexs@kernel.org>
On 28.04.24 12:06, alexs@kernel.org wrote:
> From: "Alex Shi (tencent)" <alexs@kernel.org>
>
> To distinguish ksm_mm_slot and mm_slot for better code readability,
> rename mm_slot_cache as ksm_slot_cache. No function change.
>
> Signed-off-by: Alex Shi (tencent) <alexs@kernel.org>
> Cc: David Hildenbrand <david@redhat.com>
> ---
> mm/ksm.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 6efa33c48381..22d2132f83a4 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -247,7 +247,7 @@ static struct ksm_scan ksm_scan = {
>
> static struct kmem_cache *rmap_item_cache;
> static struct kmem_cache *stable_node_cache;
> -static struct kmem_cache *mm_slot_cache;
> +static struct kmem_cache *ksm_slot_cache;
>
> /* Default number of pages to scan per batch */
> #define DEFAULT_PAGES_TO_SCAN 100
> @@ -502,8 +502,8 @@ static int __init ksm_slab_init(void)
> if (!stable_node_cache)
> goto out_free1;
>
> - mm_slot_cache = KSM_KMEM_CACHE(ksm_mm_slot, 0);
> - if (!mm_slot_cache)
> + ksm_slot_cache = KSM_KMEM_CACHE(ksm_mm_slot, 0);
> + if (!ksm_slot_cache)
> goto out_free2;
>
> return 0;
> @@ -518,10 +518,10 @@ static int __init ksm_slab_init(void)
>
> static void __init ksm_slab_free(void)
> {
> - kmem_cache_destroy(mm_slot_cache);
> + kmem_cache_destroy(ksm_slot_cache);
> kmem_cache_destroy(stable_node_cache);
> kmem_cache_destroy(rmap_item_cache);
> - mm_slot_cache = NULL;
> + ksm_slot_cache = NULL;
> }
>
> static __always_inline bool is_stable_node_chain(struct ksm_stable_node *chain)
> @@ -1244,7 +1244,7 @@ static int unmerge_and_remove_all_rmap_items(void)
> list_del(&ksm_slot->slot.mm_node);
> spin_unlock(&ksm_mmlist_lock);
>
> - mm_slot_free(mm_slot_cache, ksm_slot);
> + mm_slot_free(ksm_slot_cache, ksm_slot);
> clear_bit(MMF_VM_MERGEABLE, &mm->flags);
> clear_bit(MMF_VM_MERGE_ANY, &mm->flags);
> mmdrop(mm);
> @@ -2713,7 +2713,7 @@ static struct ksm_rmap_item *scan_get_next_rmap_item(struct page **page)
> list_del(&ksm_slot->slot.mm_node);
> spin_unlock(&ksm_mmlist_lock);
>
> - mm_slot_free(mm_slot_cache, ksm_slot);
> + mm_slot_free(ksm_slot_cache, ksm_slot);
> clear_bit(MMF_VM_MERGEABLE, &mm->flags);
> clear_bit(MMF_VM_MERGE_ANY, &mm->flags);
> mmap_read_unlock(mm);
> @@ -2972,7 +2972,7 @@ int __ksm_enter(struct mm_struct *mm)
> struct mm_slot *slot;
> int needs_wakeup;
>
> - ksm_slot = mm_slot_alloc(mm_slot_cache);
> + ksm_slot = mm_slot_alloc(ksm_slot_cache);
Similarly, this makes the code more confusion. The pattern in khugepaged
is similarly:
mm_slot = mm_slot_alloc(mm_slot_cache);
I don't think we want these renamings.
E.g., "ksm_mm_slot_cache" might be a bit better than "mm_slot_cache".
But then, we are in KSM code ... so I don't really see an improvement.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-04-30 12:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-28 10:06 [PATCH 1/4] mm/ksm: rename mm_slot members to ksm_slot for better readability alexs
2024-04-28 10:06 ` [PATCH 2/4] mm/ksm: rename variable mm_slot to ksm_slot in unmerge_and_remove_all_rmap_items alexs
2024-04-28 10:06 ` [PATCH 3/4] mm/ksm: rename mm_slot_cache to ksm_slot_cache alexs
2024-04-30 12:57 ` David Hildenbrand [this message]
2024-05-16 12:15 ` Alex Shi
2024-05-22 11:49 ` David Hildenbrand
2024-04-28 10:06 ` [PATCH 4/4] mm/ksm: rename mm_slot for get_next_rmap_item alexs
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=2e074a0b-7ab6-4381-9216-31f68a738a07@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=izik.eidus@ravellosystems.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).