All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/swap_slots: use conditional compilation for swap_slots.c
@ 2018-01-30 23:14 ` Randy Dunlap
  0 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2018-01-30 23:14 UTC (permalink / raw)
  To: Linux MM, Andrew Morton; +Cc: Tim Chen, LKML

From: Randy Dunlap <rdunlap@infradead.org>

For mm/swap_slots.c, use the traditional Linux method of conditional
compilation and linking instead of always compiling it by using
#ifdef CONFIG_SWAP and #endif for the entire source file (excluding
header files).

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
---
 mm/Makefile     |    4 ++--
 mm/swap_slots.c |    4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)

Tim, is there some reason that this is done as it currently is?

--- lnx-415.orig/mm/Makefile
+++ lnx-415/mm/Makefile
@@ -37,7 +37,7 @@ obj-y			:= filemap.o mempool.o oom_kill.
 			   readahead.o swap.o truncate.o vmscan.o shmem.o \
 			   util.o mmzone.o vmstat.o backing-dev.o \
 			   mm_init.o mmu_context.o percpu.o slab_common.o \
-			   compaction.o vmacache.o swap_slots.o \
+			   compaction.o vmacache.o \
 			   interval_tree.o list_lru.o workingset.o \
 			   debug.o $(mmu-y)
 
@@ -55,7 +55,7 @@ ifdef CONFIG_MMU
 endif
 obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
 
-obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o
+obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o swap_slots.o
 obj-$(CONFIG_FRONTSWAP)	+= frontswap.o
 obj-$(CONFIG_ZSWAP)	+= zswap.o
 obj-$(CONFIG_HAS_DMA)	+= dmapool.o
--- lnx-415.orig/mm/swap_slots.c
+++ lnx-415/mm/swap_slots.c
@@ -34,8 +34,6 @@
 #include <linux/mutex.h>
 #include <linux/mm.h>
 
-#ifdef CONFIG_SWAP
-
 static DEFINE_PER_CPU(struct swap_slots_cache, swp_slots);
 static bool	swap_slot_cache_active;
 bool	swap_slot_cache_enabled;
@@ -356,5 +354,3 @@ repeat:
 
 	return entry;
 }
-
-#endif /* CONFIG_SWAP */

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

* [PATCH] mm/swap_slots: use conditional compilation for swap_slots.c
@ 2018-01-30 23:14 ` Randy Dunlap
  0 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2018-01-30 23:14 UTC (permalink / raw)
  To: Linux MM, Andrew Morton; +Cc: Tim Chen, LKML

From: Randy Dunlap <rdunlap@infradead.org>

For mm/swap_slots.c, use the traditional Linux method of conditional
compilation and linking instead of always compiling it by using
#ifdef CONFIG_SWAP and #endif for the entire source file (excluding
header files).

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
---
 mm/Makefile     |    4 ++--
 mm/swap_slots.c |    4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)

Tim, is there some reason that this is done as it currently is?

--- lnx-415.orig/mm/Makefile
+++ lnx-415/mm/Makefile
@@ -37,7 +37,7 @@ obj-y			:= filemap.o mempool.o oom_kill.
 			   readahead.o swap.o truncate.o vmscan.o shmem.o \
 			   util.o mmzone.o vmstat.o backing-dev.o \
 			   mm_init.o mmu_context.o percpu.o slab_common.o \
-			   compaction.o vmacache.o swap_slots.o \
+			   compaction.o vmacache.o \
 			   interval_tree.o list_lru.o workingset.o \
 			   debug.o $(mmu-y)
 
@@ -55,7 +55,7 @@ ifdef CONFIG_MMU
 endif
 obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
 
-obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o
+obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o swap_slots.o
 obj-$(CONFIG_FRONTSWAP)	+= frontswap.o
 obj-$(CONFIG_ZSWAP)	+= zswap.o
 obj-$(CONFIG_HAS_DMA)	+= dmapool.o
--- lnx-415.orig/mm/swap_slots.c
+++ lnx-415/mm/swap_slots.c
@@ -34,8 +34,6 @@
 #include <linux/mutex.h>
 #include <linux/mm.h>
 
-#ifdef CONFIG_SWAP
-
 static DEFINE_PER_CPU(struct swap_slots_cache, swp_slots);
 static bool	swap_slot_cache_active;
 bool	swap_slot_cache_enabled;
@@ -356,5 +354,3 @@ repeat:
 
 	return entry;
 }
-
-#endif /* CONFIG_SWAP */


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

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

* Re: [PATCH] mm/swap_slots: use conditional compilation for swap_slots.c
  2018-01-30 23:14 ` Randy Dunlap
@ 2018-01-30 23:54   ` Tim Chen
  -1 siblings, 0 replies; 4+ messages in thread
From: Tim Chen @ 2018-01-30 23:54 UTC (permalink / raw)
  To: Randy Dunlap, Linux MM, Andrew Morton; +Cc: LKML

On 01/30/2018 03:14 PM, Randy Dunlap wrote:
> From: Randy Dunlap <rdunlap@infradead.org>
> 
> For mm/swap_slots.c, use the traditional Linux method of conditional
> compilation and linking instead of always compiling it by using
> #ifdef CONFIG_SWAP and #endif for the entire source file (excluding
> header files).
> 
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Tim Chen <tim.c.chen@linux.intel.com>
> ---
>  mm/Makefile     |    4 ++--
>  mm/swap_slots.c |    4 ----
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> Tim, is there some reason that this is done as it currently is?

Rearranging code the way you have proposed makes sense.
You can add my ack.

Thanks.

Tim

> 
> --- lnx-415.orig/mm/Makefile
> +++ lnx-415/mm/Makefile
> @@ -37,7 +37,7 @@ obj-y			:= filemap.o mempool.o oom_kill.
>  			   readahead.o swap.o truncate.o vmscan.o shmem.o \
>  			   util.o mmzone.o vmstat.o backing-dev.o \
>  			   mm_init.o mmu_context.o percpu.o slab_common.o \
> -			   compaction.o vmacache.o swap_slots.o \
> +			   compaction.o vmacache.o \
>  			   interval_tree.o list_lru.o workingset.o \
>  			   debug.o $(mmu-y)
>  
> @@ -55,7 +55,7 @@ ifdef CONFIG_MMU
>  endif
>  obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
>  
> -obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o
> +obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o swap_slots.o
>  obj-$(CONFIG_FRONTSWAP)	+= frontswap.o
>  obj-$(CONFIG_ZSWAP)	+= zswap.o
>  obj-$(CONFIG_HAS_DMA)	+= dmapool.o
> --- lnx-415.orig/mm/swap_slots.c
> +++ lnx-415/mm/swap_slots.c
> @@ -34,8 +34,6 @@
>  #include <linux/mutex.h>
>  #include <linux/mm.h>
>  
> -#ifdef CONFIG_SWAP
> -
>  static DEFINE_PER_CPU(struct swap_slots_cache, swp_slots);
>  static bool	swap_slot_cache_active;
>  bool	swap_slot_cache_enabled;
> @@ -356,5 +354,3 @@ repeat:
>  
>  	return entry;
>  }
> -
> -#endif /* CONFIG_SWAP */
> 
> 

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

* Re: [PATCH] mm/swap_slots: use conditional compilation for swap_slots.c
@ 2018-01-30 23:54   ` Tim Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Chen @ 2018-01-30 23:54 UTC (permalink / raw)
  To: Randy Dunlap, Linux MM, Andrew Morton; +Cc: LKML

On 01/30/2018 03:14 PM, Randy Dunlap wrote:
> From: Randy Dunlap <rdunlap@infradead.org>
> 
> For mm/swap_slots.c, use the traditional Linux method of conditional
> compilation and linking instead of always compiling it by using
> #ifdef CONFIG_SWAP and #endif for the entire source file (excluding
> header files).
> 
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Tim Chen <tim.c.chen@linux.intel.com>
> ---
>  mm/Makefile     |    4 ++--
>  mm/swap_slots.c |    4 ----
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> Tim, is there some reason that this is done as it currently is?

Rearranging code the way you have proposed makes sense.
You can add my ack.

Thanks.

Tim

> 
> --- lnx-415.orig/mm/Makefile
> +++ lnx-415/mm/Makefile
> @@ -37,7 +37,7 @@ obj-y			:= filemap.o mempool.o oom_kill.
>  			   readahead.o swap.o truncate.o vmscan.o shmem.o \
>  			   util.o mmzone.o vmstat.o backing-dev.o \
>  			   mm_init.o mmu_context.o percpu.o slab_common.o \
> -			   compaction.o vmacache.o swap_slots.o \
> +			   compaction.o vmacache.o \
>  			   interval_tree.o list_lru.o workingset.o \
>  			   debug.o $(mmu-y)
>  
> @@ -55,7 +55,7 @@ ifdef CONFIG_MMU
>  endif
>  obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
>  
> -obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o
> +obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o swap_slots.o
>  obj-$(CONFIG_FRONTSWAP)	+= frontswap.o
>  obj-$(CONFIG_ZSWAP)	+= zswap.o
>  obj-$(CONFIG_HAS_DMA)	+= dmapool.o
> --- lnx-415.orig/mm/swap_slots.c
> +++ lnx-415/mm/swap_slots.c
> @@ -34,8 +34,6 @@
>  #include <linux/mutex.h>
>  #include <linux/mm.h>
>  
> -#ifdef CONFIG_SWAP
> -
>  static DEFINE_PER_CPU(struct swap_slots_cache, swp_slots);
>  static bool	swap_slot_cache_active;
>  bool	swap_slot_cache_enabled;
> @@ -356,5 +354,3 @@ repeat:
>  
>  	return entry;
>  }
> -
> -#endif /* CONFIG_SWAP */
> 
> 

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

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

end of thread, other threads:[~2018-01-30 23:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30 23:14 [PATCH] mm/swap_slots: use conditional compilation for swap_slots.c Randy Dunlap
2018-01-30 23:14 ` Randy Dunlap
2018-01-30 23:54 ` Tim Chen
2018-01-30 23:54   ` Tim Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.