linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: wale zhang <wale.zhang.ftd@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Barry Song <21cnbao@gmail.com>,
	chrisl@kernel.org, ziy@nvidia.com, lorenzo.stoakes@oracle.com,
	matthew.brost@intel.com, linux-mm@kvack.org
Subject: Re: [PATCH v2] mm/swapops,rmap: remove should-never-be-compiled codes.
Date: Wed, 31 Dec 2025 13:17:00 +0100	[thread overview]
Message-ID: <6e5c60e7-3a9f-4953-83b6-422ca080ce52@kernel.org> (raw)
In-Reply-To: <CAHrEdetx_AUGa8Qk3JF-tgCZVJsfnfcLLSkkOVc_5ra6K6Q6Kg@mail.gmail.com>

> 
> Hello David,
> 
> folio_inc_return_large_mapcount and folio_dec_return_large_mapcount
> are only used when CONFIG_NO_PAGE_MAPCOUNT is defined.

It's conceptually wrong to leak CONFIG_NO_PAGE_MAPCOUNT in something that is
CONFIG_MM_ID material at this point.

> 
>>
>>
>> So if the following makes compilers happy, fine with me:
> 
> Apart from the solution as below, I can't think of any other ways. Do
> you have any good ideas?

Leave the code alone.

What we *could* do is

diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index daa92a58585d9..ae495c225717a 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -354,11 +354,8 @@ static inline void folio_add_large_mapcount(struct folio *folio,
         atomic_add(diff, &folio->_large_mapcount);
  }
  
-static inline int folio_add_return_large_mapcount(struct folio *folio,
-               int diff, struct vm_area_struct *vma)
-{
-       BUILD_BUG();
-}
+int folio_add_return_large_mapcount(struct folio *folio,
+               int diff, struct vm_area_struct *vma);
  
  static inline void folio_sub_large_mapcount(struct folio *folio,
                 int diff, struct vm_area_struct *vma)
@@ -366,11 +363,8 @@ static inline void folio_sub_large_mapcount(struct folio *folio,
         atomic_sub(diff, &folio->_large_mapcount);
  }
  
-static inline int folio_sub_return_large_mapcount(struct folio *folio,
-               int diff, struct vm_area_struct *vma)
-{
-       BUILD_BUG();
-}
+int folio_sub_return_large_mapcount(struct folio *folio,
+               int diff, struct vm_area_struct *vma);
  #endif /* CONFIG_MM_ID */
  
  #define folio_inc_large_mapcount(folio, vma) \


But then, I have patches here in the works that actually fill these functions
with life.

So leave the code alone; I'm sure that is something with more added value
to be done in the kernel :)

-- 
Cheers

David


  reply	other threads:[~2025-12-31 12:17 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
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) [this message]
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=6e5c60e7-3a9f-4953-83b6-422ca080ce52@kernel.org \
    --to=david@kernel.org \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@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