mm: swap prefetch aggressive mode
Subsystems (2)
PATCH 2/3 mm: swap prefetch aggressive mode
Add an "aggressive" mode to swap prefetch that overrides most of the checks that prevent swap prefetch from doing any prefetching when the system is not idle. Make it a transient bit that can be set in the /proc tunable which makes it a use once setting - the most likely way such a mode will be useful.
Export the aggressive_swap_prefetch function to allow other code to set it if it is deemed suitable.
Such a mode would be useful, for example, immediately after resuming from suspend-to-disk.
--- Documentation/sysctl/vm.txt | 15 ++++ include/linux/swap-prefetch.h | 5 + mm/swap_prefetch.c | 130 +++++++++++++++++++++++++++++------------- 3 files changed, 112 insertions(+), 38 deletions(-)
Documentation/sysctl/vm.txt +15 -0
@@ -188,4 +188,19 @@ memory subsystem has been extremely idle copying back pages from swap into the swapcache and keep a copy in swap. In practice it can take many minutes before the vm is idle enough. +This is value ORed together of +1 = Normal background swap prefetching when load is light +2 = Aggressively swap prefetch as much as possible + +ie Setting the value to 3 will prefetch aggressively then drop to 1. This +is useful for doing aggressive prefetching for short periods in scripts +such as after resuming from software suspend. Setting the value to 2 will +prefetch aggressively as much as it can and then disable any further swap +prefetching. + +Note that setting this to 0 disables even storing a list of swapped pages (to +minimise overhead) which means that if significant swapping has occurred with +swap_prefetch unset and then it is enabled, there is nothing that can be +prefetched. + The default value is 1.
mm/swap_prefetch.c +92 -38
188 lines not on this page · raw message
include/linux/swap-prefetch.h +5 -0
@@ -33,6 +33,7 @@ extern void add_to_swapped_list(struct pextern void remove_from_swapped_list (const unsigned long index);extern void delay_swap_prefetch (void );extern void prepare_swap_prefetch (void ); +extern void aggressive_swap_prefetch (void );#else /* CONFIG_SWAP_PREFETCH */ static inline void add_to_swapped_list (struct page *__unused)
@@ -50,6 +51,10 @@ static inline void remove_from_swapped_lstatic inline void delay_swap_prefetch (void ) { } + +static inline void aggressive_swap_prefetch (void ) +{ +}#endif /* CONFIG_SWAP_PREFETCH */ #endif /* SWAP_PREFETCH_H_INCLUDED */
--
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>