Re: [RFC v2 1/4] mm: rename huge_zero_page_shrinker to huge_zero_folio_shrinker

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 24, 2025 at 04:49:58PM +0200, Pankaj Raghav (Samsung) wrote:
> From: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
>
> As we already moved from exposing huge_zero_page to huge_zero_folio,
> change the name of the shrinker to reflect that.
>
> No functional changes.
>
> Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
> Acked-by: David Hildenbrand <david@xxxxxxxxxx>
> Signed-off-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>

Makes sense to rename other related stuff as pointed out by Ritesh and
David, but for this part:

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>

> ---
>  mm/huge_memory.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 2b4ea5a2ce7d..5d8365d1d3e9 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -266,15 +266,15 @@ void mm_put_huge_zero_folio(struct mm_struct *mm)
>  		put_huge_zero_page();
>  }
>
> -static unsigned long shrink_huge_zero_page_count(struct shrinker *shrink,
> -					struct shrink_control *sc)
> +static unsigned long shrink_huge_zero_folio_count(struct shrinker *shrink,
> +						  struct shrink_control *sc)
>  {
>  	/* we can free zero page only if last reference remains */
>  	return atomic_read(&huge_zero_refcount) == 1 ? HPAGE_PMD_NR : 0;
>  }
>
> -static unsigned long shrink_huge_zero_page_scan(struct shrinker *shrink,
> -				       struct shrink_control *sc)
> +static unsigned long shrink_huge_zero_folio_scan(struct shrinker *shrink,
> +						 struct shrink_control *sc)
>  {
>  	if (atomic_cmpxchg(&huge_zero_refcount, 1, 0) == 1) {
>  		struct folio *zero_folio = xchg(&huge_zero_folio, NULL);
> @@ -287,7 +287,7 @@ static unsigned long shrink_huge_zero_page_scan(struct shrinker *shrink,
>  	return 0;
>  }
>
> -static struct shrinker *huge_zero_page_shrinker;
> +static struct shrinker *huge_zero_folio_shrinker;
>
>  #ifdef CONFIG_SYSFS
>  static ssize_t enabled_show(struct kobject *kobj,
> @@ -849,8 +849,8 @@ static inline void hugepage_exit_sysfs(struct kobject *hugepage_kobj)
>
>  static int __init thp_shrinker_init(void)
>  {
> -	huge_zero_page_shrinker = shrinker_alloc(0, "thp-zero");
> -	if (!huge_zero_page_shrinker)
> +	huge_zero_folio_shrinker = shrinker_alloc(0, "thp-zero");
> +	if (!huge_zero_folio_shrinker)
>  		return -ENOMEM;
>
>  	deferred_split_shrinker = shrinker_alloc(SHRINKER_NUMA_AWARE |
> @@ -858,13 +858,13 @@ static int __init thp_shrinker_init(void)
>  						 SHRINKER_NONSLAB,
>  						 "thp-deferred_split");
>  	if (!deferred_split_shrinker) {
> -		shrinker_free(huge_zero_page_shrinker);
> +		shrinker_free(huge_zero_folio_shrinker);
>  		return -ENOMEM;
>  	}
>
> -	huge_zero_page_shrinker->count_objects = shrink_huge_zero_page_count;
> -	huge_zero_page_shrinker->scan_objects = shrink_huge_zero_page_scan;
> -	shrinker_register(huge_zero_page_shrinker);
> +	huge_zero_folio_shrinker->count_objects = shrink_huge_zero_folio_count;
> +	huge_zero_folio_shrinker->scan_objects = shrink_huge_zero_folio_scan;
> +	shrinker_register(huge_zero_folio_shrinker);
>
>  	deferred_split_shrinker->count_objects = deferred_split_count;
>  	deferred_split_shrinker->scan_objects = deferred_split_scan;
> @@ -875,7 +875,7 @@ static int __init thp_shrinker_init(void)
>
>  static void __init thp_shrinker_exit(void)
>  {
> -	shrinker_free(huge_zero_page_shrinker);
> +	shrinker_free(huge_zero_folio_shrinker);
>  	shrinker_free(deferred_split_shrinker);
>  }
>
> --
> 2.49.0
>




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux