linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] minor cleanups of include/linux/mm.h
@ 2021-04-05 15:13 Mike Rapoport
  2021-04-05 15:13 ` [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h Mike Rapoport
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mike Rapoport @ 2021-04-05 15:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matthew Wilcox, Mike Rapoport, Mike Rapoport, linux-mm, linux-kernel

From: Mike Rapoport <rppt@linux.ibm.com>

Hi,

While looking at recent page_mapping_file() changes I've noticed that
page_rmapping() and page_anon_vma() could be moved from include/linux/mm.h
and we don't need two forward declarations of page_mapping().

I've also noticed that except page_mapping_file() we have somewhat similar
page_file_mapping(), which seems superfluous, but I didn't dig further to
see how one of them can be dropped. 

The patches are vs v5.12-rc5-mmots-2021-03-31-22-26.

Mike Rapoport (2):
  mm: move page_rmapping() and page_anon_vma() to mm/internal.h
  include/linux/mm.h: remove duplicated declaration of page_mapping()

 include/linux/mm.h | 4 ----
 mm/internal.h      | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h
  2021-04-05 15:13 [PATCH 0/2] minor cleanups of include/linux/mm.h Mike Rapoport
@ 2021-04-05 15:13 ` Mike Rapoport
  2021-04-05 18:18   ` Matthew Wilcox
  2021-04-05 20:00   ` kernel test robot
  2021-04-05 15:13 ` [PATCH 2/2] include/linux/mm.h: remove duplicated declaration of page_mapping() Mike Rapoport
  2021-04-05 18:50 ` [PATCH 0/2] minor cleanups of include/linux/mm.h Matthew Wilcox
  2 siblings, 2 replies; 7+ messages in thread
From: Mike Rapoport @ 2021-04-05 15:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matthew Wilcox, Mike Rapoport, Mike Rapoport, linux-mm, linux-kernel

From: Mike Rapoport <rppt@linux.ibm.com>

The functions page_rmapping() and page_anon_vma() are not used outside core
mm. Move their declaration from include/linux/mm.h to mm/internal.h

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 include/linux/mm.h | 2 --
 mm/internal.h      | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 8ec63f37a78d..74a05dbdcc19 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1619,8 +1619,6 @@ void page_address_init(void);
 #define page_address_init()  do { } while(0)
 #endif
 
-extern void *page_rmapping(struct page *page);
-extern struct anon_vma *page_anon_vma(struct page *page);
 extern struct address_space *page_mapping(struct page *page);
 
 extern struct address_space *__page_file_mapping(struct page *);
diff --git a/mm/internal.h b/mm/internal.h
index 547a8d7f0cbb..77e0b726eef3 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -358,6 +358,9 @@ void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
 		struct vm_area_struct *prev);
 void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma);
 
+void *page_rmapping(struct page *page);
+struct anon_vma *page_anon_vma(struct page *page);
+
 #ifdef CONFIG_MMU
 extern long populate_vma_page_range(struct vm_area_struct *vma,
 		unsigned long start, unsigned long end, int *nonblocking);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] include/linux/mm.h: remove duplicated declaration of page_mapping()
  2021-04-05 15:13 [PATCH 0/2] minor cleanups of include/linux/mm.h Mike Rapoport
  2021-04-05 15:13 ` [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h Mike Rapoport
@ 2021-04-05 15:13 ` Mike Rapoport
  2021-04-05 18:16   ` Matthew Wilcox
  2021-04-05 18:50 ` [PATCH 0/2] minor cleanups of include/linux/mm.h Matthew Wilcox
  2 siblings, 1 reply; 7+ messages in thread
From: Mike Rapoport @ 2021-04-05 15:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matthew Wilcox, Mike Rapoport, Mike Rapoport, linux-mm, linux-kernel

From: Mike Rapoport <rppt@linux.ibm.com>

There are two declarations of page_mapping() in include/linux/mm.h a dozen
lines apart.

Remove the older one with unnecessary "extern".

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 include/linux/mm.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 74a05dbdcc19..d831ca0fcfa1 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1619,8 +1619,6 @@ void page_address_init(void);
 #define page_address_init()  do { } while(0)
 #endif
 
-extern struct address_space *page_mapping(struct page *page);
-
 extern struct address_space *__page_file_mapping(struct page *);
 
 static inline
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] include/linux/mm.h: remove duplicated declaration of page_mapping()
  2021-04-05 15:13 ` [PATCH 2/2] include/linux/mm.h: remove duplicated declaration of page_mapping() Mike Rapoport
@ 2021-04-05 18:16   ` Matthew Wilcox
  0 siblings, 0 replies; 7+ messages in thread
From: Matthew Wilcox @ 2021-04-05 18:16 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Andrew Morton, Mike Rapoport, linux-mm, linux-kernel

On Mon, Apr 05, 2021 at 06:13:55PM +0300, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> There are two declarations of page_mapping() in include/linux/mm.h a dozen
> lines apart.
> 
> Remove the older one with unnecessary "extern".

This conflicts with
https://lore.kernel.org/linux-mm/20210331184728.1188084-14-willy@infradead.org/

Andrew, please can we get the folio patches in?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h
  2021-04-05 15:13 ` [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h Mike Rapoport
@ 2021-04-05 18:18   ` Matthew Wilcox
  2021-04-05 20:00   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: Matthew Wilcox @ 2021-04-05 18:18 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Andrew Morton, Mike Rapoport, linux-mm, linux-kernel

On Mon, Apr 05, 2021 at 06:13:54PM +0300, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> The functions page_rmapping() and page_anon_vma() are not used outside core
> mm. Move their declaration from include/linux/mm.h to mm/internal.h
> 
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>

This has purely textual conflicts with the folio series, but no conceptual
conflicts.  I generally approve of moving things out of mm.h, so

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] minor cleanups of include/linux/mm.h
  2021-04-05 15:13 [PATCH 0/2] minor cleanups of include/linux/mm.h Mike Rapoport
  2021-04-05 15:13 ` [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h Mike Rapoport
  2021-04-05 15:13 ` [PATCH 2/2] include/linux/mm.h: remove duplicated declaration of page_mapping() Mike Rapoport
@ 2021-04-05 18:50 ` Matthew Wilcox
  2 siblings, 0 replies; 7+ messages in thread
From: Matthew Wilcox @ 2021-04-05 18:50 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Andrew Morton, Mike Rapoport, linux-mm, linux-kernel

On Mon, Apr 05, 2021 at 06:13:53PM +0300, Mike Rapoport wrote:
> I've also noticed that except page_mapping_file() we have somewhat similar
> page_file_mapping(), which seems superfluous, but I didn't dig further to
> see how one of them can be dropped. 

They can't ;-(  I looked at it, and they do different things.

+ * folio_file_mapping - Find the mapping this folio belongs to.
+ * @folio: The folio.
+ *
+ * For folios which are in the page cache, return the mapping that this
+ * page belongs to.  Folios in the swap cache return the mapping of the
+ * swap file or swap device where the data is stored.  This is different
+ * from the mapping returned by folio_mapping().  The only reason to
+ * use it is if, like NFS, you return 0 from ->activate_swapfile.

page_mapping_file() returns NULL for pages which are in the swap cache,
as they no longer need the dcache flushed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h
  2021-04-05 15:13 ` [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h Mike Rapoport
  2021-04-05 18:18   ` Matthew Wilcox
@ 2021-04-05 20:00   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-04-05 20:00 UTC (permalink / raw)
  To: Mike Rapoport, Andrew Morton
  Cc: kbuild-all, clang-built-linux, Linux Memory Management List,
	Matthew Wilcox, Mike Rapoport, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4074 bytes --]

Hi Mike,

I love your patch! Yet something to improve:

[auto build test ERROR on hnaz-linux-mm/master]
[also build test ERROR on v5.12-rc6 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mike-Rapoport/minor-cleanups-of-include-linux-mm-h/20210405-231514
base:   https://github.com/hnaz/linux-mm master
config: x86_64-randconfig-a004-20210405 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 2760a808b9916a2839513b7fd7314a464f52481e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/c025240d41e9b6388c57fd4cde4a520074e41539
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mike-Rapoport/minor-cleanups-of-include-linux-mm-h/20210405-231514
        git checkout c025240d41e9b6388c57fd4cde4a520074e41539
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> mm/page_idle.c:105:7: error: implicit declaration of function 'page_rmapping' [-Werror,-Wimplicit-function-declaration]
               !page_rmapping(page))
                ^
   mm/page_idle.c:105:7: note: did you mean 'page_mapping'?
   include/linux/mm.h:1549:23: note: 'page_mapping' declared here
   struct address_space *page_mapping(struct page *page);
                         ^
   1 error generated.


vim +/page_rmapping +105 mm/page_idle.c

33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   91  
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   92  static void page_idle_clear_pte_refs(struct page *page)
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   93  {
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   94  	/*
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   95  	 * Since rwc.arg is unused, rwc is effectively immutable, so we
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   96  	 * can make it static const to save some cycles and stack.
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   97  	 */
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   98  	static const struct rmap_walk_control rwc = {
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09   99  		.rmap_one = page_idle_clear_pte_refs_one,
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  100  		.anon_lock = page_lock_anon_vma_read,
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  101  	};
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  102  	bool need_lock;
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  103  
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  104  	if (!page_mapped(page) ||
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09 @105  	    !page_rmapping(page))
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  106  		return;
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  107  
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  108  	need_lock = !PageAnon(page) || PageKsm(page);
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  109  	if (need_lock && !trylock_page(page))
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  110  		return;
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  111  
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  112  	rmap_walk(page, (struct rmap_walk_control *)&rwc);
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  113  
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  114  	if (need_lock)
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  115  		unlock_page(page);
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  116  }
33c3fc71c8cfa3 Vladimir Davydov 2015-09-09  117  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27053 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-05 20:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-05 15:13 [PATCH 0/2] minor cleanups of include/linux/mm.h Mike Rapoport
2021-04-05 15:13 ` [PATCH 1/2] mm: move page_rmapping() and page_anon_vma() to mm/internal.h Mike Rapoport
2021-04-05 18:18   ` Matthew Wilcox
2021-04-05 20:00   ` kernel test robot
2021-04-05 15:13 ` [PATCH 2/2] include/linux/mm.h: remove duplicated declaration of page_mapping() Mike Rapoport
2021-04-05 18:16   ` Matthew Wilcox
2021-04-05 18:50 ` [PATCH 0/2] minor cleanups of include/linux/mm.h Matthew Wilcox

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).