Messages in this thread | | | Date | Tue, 30 Apr 2024 14:57:05 +0200 | Subject | Re: [PATCH 3/4] mm/ksm: rename mm_slot_cache to ksm_slot_cache | From | David Hildenbrand <> |
| |
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
| |