linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Wale Zhang <wale.zhang.ftd@gmail.com>
Cc: chrisl@kernel.org, ziy@nvidia.com, lorenzo.stoakes@oracle.com,
	david@kernel.org, baohua@kernel.org, matthew.brost@intel.com,
	linux-mm@kvack.org
Subject: Re: [PATCH v2] mm/swapops,rmap: remove should-never-be-compiled codes.
Date: Tue, 30 Dec 2025 10:10:29 -0800	[thread overview]
Message-ID: <20251230101029.8471aea6c786ab33a85c55ca@linux-foundation.org> (raw)
In-Reply-To: <20251230130110.1366374-1-wale.zhang.ftd@gmail.com>

On Tue, 30 Dec 2025 21:01:10 +0800 Wale Zhang <wale.zhang.ftd@gmail.com> wrote:

> mm/swapops,rmap: remove should-never-be-compiled codes, included
> folio_add_return_large_mapcount(), folio_sub_return_large_mapcount(),
> set_pmd_migration_entry() and remove_migration_pmd().

Please provide a reason for making this change.

>
> ...
>
> @@ -1264,22 +1262,21 @@ static __always_inline void __folio_add_rmap(struct folio *folio,
>  			nr = first;
>  
>  		folio_add_large_mapcount(folio, orig_nr_pages, vma);
> +#endif
>  		break;
>  	case PGTABLE_LEVEL_PMD:
>  	case PGTABLE_LEVEL_PUD:
>  		first = atomic_inc_and_test(&folio->_entire_mapcount);
> -		if (IS_ENABLED(CONFIG_NO_PAGE_MAPCOUNT)) {
> -			if (level == PGTABLE_LEVEL_PMD && first)
> -				nr_pmdmapped = folio_large_nr_pages(folio);
> -			nr = folio_inc_return_large_mapcount(folio, vma);
> -			if (nr == 1)
> -				/* Was completely unmapped. */
> -				nr = folio_large_nr_pages(folio);
> -			else
> -				nr = 0;
> -			break;
> -		}
> -
> +#ifdef CONFIG_NO_PAGE_MAPCOUNT
> +		if (level == PGTABLE_LEVEL_PMD && first)
> +			nr_pmdmapped = folio_large_nr_pages(folio);
> +		nr = folio_inc_return_large_mapcount(folio, vma);
> +		if (nr == 1)
> +			/* Was completely unmapped. */
> +			nr = folio_large_nr_pages(folio);
> +		else
> +			nr = 0;
> +#else

Changes like this made the code unpleasant to read and harder to work
on.  What do we get in return for this?


  reply	other threads:[~2025-12-30 18:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30 13:01 Wale Zhang
2025-12-30 18:10 ` Andrew Morton [this message]
2025-12-30 19:50 ` David Hildenbrand (Red Hat)
2025-12-30 21:28   ` Barry Song
2025-12-30 21:35     ` Andrew Morton
2025-12-30 21:59       ` David Hildenbrand (Red Hat)
2025-12-31 11:58         ` wale zhang
2025-12-31 12:17           ` David Hildenbrand (Red Hat)
2025-12-31  9:30       ` wale zhang

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=20251230101029.8471aea6c786ab33a85c55ca@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=chrisl@kernel.org \
    --cc=david@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=matthew.brost@intel.com \
    --cc=wale.zhang.ftd@gmail.com \
    --cc=ziy@nvidia.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