linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Fix compile error when CONFIG_SHMEM is not set
@ 2025-06-02 21:05 Steven Rostedt
  2025-06-02 21:14 ` Steven Rostedt
  0 siblings, 1 reply; 13+ messages in thread
From: Steven Rostedt @ 2025-06-02 21:05 UTC (permalink / raw)
  To: LKML, linux-mm
  Cc: Hugh Dickins, Andrew Morton, Matthew Wilcox (Oracle),
	Linus Torvalds

From: Steven Rostedt <rostedt@goodmis.org>

When CONFIG_SHMEM is not set, the following compiler error occurs:

ld: vmlinux.o: in function `ttm_backup_backup_page':
(.text+0x10363bc): undefined reference to `shmem_writeout'
make[3]: *** [/work/build/trace/nobackup/linux-test.git/scripts/Makefile.vmlinux:91: vmlinux.unstripped] Error 1
make[2]: *** [/work/build/trace/nobackup/linux-test.git/Makefile:1241: vmlinux] Error 2
make[1]: *** [/work/build/trace/nobackup/linux-test.git/Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/work/build/nobackup/tracetest'
make: *** [Makefile:248: __sub-make] Error 2

This is due to the replacement of writepage and calling swap_writepage()
and shmem_writepage() directly. The issue is that when CONFIG_SHMEM is not
defined, shmem_writepage() is also not defined. Add it as a stub, and it
should also never be called when CONFIG_SHMEM is undefined.

Fixes: 84798514db50 ("mm: Remove swap_writepage() and shmem_writepage()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 mm/shmem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/shmem.c b/mm/shmem.c
index 858cee02ca49..dec85388030a 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5760,6 +5760,11 @@ void shmem_unlock_mapping(struct address_space *mapping)
 {
 }
 
+int shmem_writeout(struct folio *folio, struct writeback_control *wbc)
+{
+	return 0;
+}
+
 #ifdef CONFIG_MMU
 unsigned long shmem_get_unmapped_area(struct file *file,
 				      unsigned long addr, unsigned long len,
-- 
2.47.2



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

end of thread, other threads:[~2025-06-04 12:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-02 21:05 [PATCH] mm: Fix compile error when CONFIG_SHMEM is not set Steven Rostedt
2025-06-02 21:14 ` Steven Rostedt
2025-06-02 21:46   ` Matthew Wilcox
2025-06-03  8:02     ` Hugh Dickins
2025-06-03 14:29       ` Steven Rostedt
2025-06-03 16:26         ` Matthew Wilcox
2025-06-03 17:27           ` Steven Rostedt
2025-06-03 17:54             ` Linus Torvalds
2025-06-03 18:06               ` Steven Rostedt
2025-06-04  7:03                 ` Hugh Dickins
2025-06-04 12:04                   ` Steven Rostedt
2025-06-04 12:18                     ` Thomas Hellström
2025-06-04 12:23                       ` Steven Rostedt

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