Skip to contentSkip to conversation

allow CONFIG_SWAP=n for i386

PATCH In review Christoph Hellwig 3 participants 6 messages Feb 26, 2003 – Feb 27, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 allow CONFIG_SWAP=n for i386

There's a bunch of minor fixes needed to disable the swap code for systems with mmu.

arch/i386/Kconfig +6 -1
@@ -19,8 +19,13 @@
 	default y
 
 config SWAP
-	bool
+	bool "Support for paging of anonymous memory"
 	default y
+	help
+	  This option allows you to choose whether you want to have support
+	  for socalled swap devices or swap files in your kernel that are
+	  used to provide more virtual memory than the actual RAM present
+	  in your computer.  If unusre say Y.
 
 config SBUS
 	bool

===== arch/i386/mm/pgtable.c 1.7 vs edited =====

arch/i386/mm/pgtable.c +1 -0
@@ -11,6 +11,7 @@
 #include <linux/smp.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
+#include <linux/pagemap.h>
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
include/linux/swap.h +13 -11
@@ -68,10 +68,11 @@
 
 #ifdef __KERNEL__
 
-struct sysinfo;
 struct address_space;
-struct zone;
+struct pte_chain;
+struct sysinfo;
 struct writeback_control;
+struct zone;
 
 /*
  * A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of
@@ -140,6 +141,9 @@
 /* Swap 50% full? Release swapcache more aggressively.. */
 #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
 
+/* linux/mm/oom_kill.c */
+extern void out_of_memory(void);
+
 /* linux/mm/page_alloc.c */
 extern unsigned long totalram_pages;
 extern unsigned long totalhigh_pages;
@@ -149,13 +153,11 @@
 extern unsigned int nr_free_buffer_pages(void);
 extern unsigned int nr_free_pagecache_pages(void);
 
-/* linux/mm/filemap.c */
-extern void FASTCALL(mark_page_accessed(struct page *));
-
 /* linux/mm/swap.c */
 extern void FASTCALL(lru_cache_add(struct page *));
 extern void FASTCALL(lru_cache_add_active(struct page *));
 extern void FASTCALL(activate_page(struct page *));
+extern void FASTCALL(mark_page_accessed(struct page *));
 extern void lru_add_drain(void);
 extern int rotate_reclaimable_page(struct page *page);
 extern void swap_setup(void);
@@ -165,11 +167,8 @@
 extern int shrink_all_memory(int);
 extern int vm_swappiness;
 
-/* linux/mm/oom_kill.c */
-extern void out_of_memory(void);
-
 /* linux/mm/rmap.c */
-struct pte_chain;
+#ifdef CONFIG_MMU
 int FASTCALL(page_referenced(struct page *));
 struct pte_chain *FASTCALL(page_add_rmap(struct page *, pte_t *,
 					struct pte_chain *));
@@ -186,6 +185,11 @@
 /* linux/mm/shmem.c */
 extern int shmem_unuse(swp_entry_t entry, struct page *page);
 
+#else
+#define page_referenced(page) \
+	TestClearPageReferenced(page)
+#endif /* CONFIG_MMU */
+
 #ifdef CONFIG_SWAP
 /* linux/mm/page_io.c */
 extern int swap_readpage(struct file *, struct page *);
@@ -242,8 +246,6 @@
 	page_cache_release(page)
 #define free_pages_and_swap_cache(pages, nr) \
 	release_pages((pages), (nr), 0);
-#define page_referenced(page) \
-	TestClearPageReferenced(page)
 
 #define show_swap_cache_info()			/*NOTHING*/
 #define free_swap_and_cache(swp)		/*NOTHING*/
mm/swap.c +0 -1
@@ -363,5 +363,4 @@
 	 * Right now other parts of the system means that we
 	 * _really_ don't want to cluster much more
 	 */
-	init_MUTEX(&swapper_space.i_shared_sem);
 }
mm/swap_state.c +14 -13
@@ -33,19 +33,20 @@
 extern struct address_space_operations swap_aops;
 
 struct address_space swapper_space = {
-	.page_tree		= RADIX_TREE_INIT(GFP_ATOMIC),
-	.page_lock		= RW_LOCK_UNLOCKED,
-	.clean_pages		= LIST_HEAD_INIT(swapper_space.clean_pages),
-	.dirty_pages		= LIST_HEAD_INIT(swapper_space.dirty_pages),
-	.io_pages		= LIST_HEAD_INIT(swapper_space.io_pages),
-	.locked_pages		= LIST_HEAD_INIT(swapper_space.locked_pages),
-	.host			= &swapper_inode,
-	.a_ops			= &swap_aops,
-	.backing_dev_info	= &swap_backing_dev_info,
-	.i_mmap			= LIST_HEAD_INIT(swapper_space.i_mmap),
-	.i_mmap_shared		= LIST_HEAD_INIT(swapper_space.i_mmap_shared),
-	.private_lock		= SPIN_LOCK_UNLOCKED,
-	.private_list		= LIST_HEAD_INIT(swapper_space.private_list),
+	.page_tree	= RADIX_TREE_INIT(GFP_ATOMIC),
+	.page_lock	= RW_LOCK_UNLOCKED,
+	.clean_pages	= LIST_HEAD_INIT(swapper_space.clean_pages),
+	.dirty_pages	= LIST_HEAD_INIT(swapper_space.dirty_pages),
+	.io_pages	= LIST_HEAD_INIT(swapper_space.io_pages),
+	.locked_pages	= LIST_HEAD_INIT(swapper_space.locked_pages),
+	.host		= &swapper_inode,
+	.a_ops		= &swap_aops,
+	.backing_dev_info = &swap_backing_dev_info,
+	.i_mmap		= LIST_HEAD_INIT(swapper_space.i_mmap),
+	.i_mmap_shared	= LIST_HEAD_INIT(swapper_space.i_mmap_shared),
+	.i_shared_sem	= __MUTEX_INITIALIZER(&swapper_space.i_shared_sem),
+	.private_lock	= SPIN_LOCK_UNLOCKED,
+	.private_list	= LIST_HEAD_INIT(swapper_space.private_list),
 };
 
 #define INC_CACHE_INFO(x)	do { swap_cache_info.x++; } while (0)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>

#1 lore raw
Quoted 3 lines · Christoph Hellwig

There's a bunch of minor fixes needed to disable the swap code for systems with mmu.

A worthy objective.

mm/swap_state.c line 47

Quoted 1 line
mm/swap_state.c +1 -0
+	.i_shared_sem	= __MUTEX_INITIALIZER(&swapper_space.i_shared_sem),

arch/um des not have __MUTEX_INITIALIZER, and I'm not sure that we want to promote this to part of the kernel API, do we?

Might be better to leave that bit alone. Maybe stick an initcall into swap_state.c for it.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>

#2 lore raw
Quoted 5 lines · Andrew Morton
Quoted 2 lines

There's a bunch of minor fixes needed to disable the swap code for systems with mmu.

A worthy objective.

Quoted 7 lines

mm/swap_state.c line 47

Quoted 1 line
mm/swap_state.c +1 -0
+	.i_shared_sem	= __MUTEX_INITIALIZER(&swapper_space.i_shared_sem),

arch/um des not have __MUTEX_INITIALIZER, and I'm not sure that we want to promote this to part of the kernel API, do we?

Might be better to leave that bit alone. Maybe stick an initcall into swap_state.c for it.

Personally I'd prefer to use __MUTEX_INITIALIZER because we really need a way to intialize a semaphore at compile time. Would either using __SEMAPHORE_INITIALIZER() or renaming one of them to something more sane be okay with you?

If we need to go the initcall way there's already one in swapfile.c

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>

#3 lore raw
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Andrew Morton
Quoted 2 lines

There's a bunch of minor fixes needed to disable the swap code for systems with mmu.

A worthy objective.

mm/swap_state.c line 47

Quoted 1 line
mm/swap_state.c +1 -0
+	.i_shared_sem	= __MUTEX_INITIALIZER(&swapper_space.i_shared_sem),

arch/um des not have __MUTEX_INITIALIZER, and I'm not sure that we want to promote this to part of the kernel API, do we?

Quoted 7 lines
Quoted 2 lines

Might be better to leave that bit alone. Maybe stick an initcall into swap_state.c for it.

Personally I'd prefer to use __MUTEX_INITIALIZER because we really need a way to intialize a semaphore at compile time. Would either using __SEMAPHORE_INITIALIZER() or renaming one of them to something more sane be okay with you?

Actually I think I misread the UML code - seems that it just includes the host architecture's semaphore.h, so what you have should be fine. I'll queue it up.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>

#4 lore raw
In reply to Christoph Hellwig

mm/swap_state.c line 47

Quoted 5 lines · Christoph Hellwig

There's a bunch of minor fixes needed to disable the swap code for systems with mmu.

mm/swap_state.c +1 -0
+	.i_shared_sem	= __MUTEX_INITIALIZER(&swapper_space.i_shared_sem),

The ampersand needs to be removed.

Please at least compile-test stuff. Actually checking that it runs appears to be optional lately anyway.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>

#5 lore raw
Quoted 11 lines · Andrew Morton

mm/swap_state.c line 47

Quoted 5 lines · Christoph Hellwig

There's a bunch of minor fixes needed to disable the swap code for systems with mmu.

mm/swap_state.c +1 -0
+	.i_shared_sem	= __MUTEX_INITIALIZER(&swapper_space.i_shared_sem),

The ampersand needs to be removed.

Please at least compile-test stuff. Actually checking that it runs appears to be optional lately anyway.

Well, it runs fine without CONFIG_SWAP, the box is up for two days now :)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>