mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
frontswap: get rid of swap_lock dependency
Frontswap initialization routine depends on swap_lock, which want to be atomic about frontswap's first appearance. IOW, frontswap is not present and will fail all calls OR frontswap is fully functional but if new swap_info_struct isn't registered by enable_swap_info, swap subsystem doesn't start I/O so there is no race between init procedure and page I/O working on frontswap. So let's remove unnecessary swap_lock dependency. Cc: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Minchan Kim <minchan@kernel.org> [v1: Rebased on my branch, reworked to work with backends loading late] [v2: Added a check for !map] [v3: Made the invalidate path follow the init path] [v4: Address comments by Wanpeng Li <liwanp@linux.vnet.ibm.com>] Signed-off-by: Konrad Rzeszutek Wilk <konrad@darnok.org> Signed-off-by: Bob Liu <lliubbo@gmail.com> Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com> Cc: Andor Daam <andor.daam@googlemail.com> Cc: Florian Schmaus <fschmaus@gmail.com> Cc: Stefan Hengelein <ilendir@googlemail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f066ea230a
commit
4f89849da2
3 changed files with 35 additions and 19 deletions
|
@ -23,7 +23,7 @@ extern void frontswap_writethrough(bool);
|
|||
extern void frontswap_tmem_exclusive_gets(bool);
|
||||
|
||||
extern bool __frontswap_test(struct swap_info_struct *, pgoff_t);
|
||||
extern void __frontswap_init(unsigned type);
|
||||
extern void __frontswap_init(unsigned type, unsigned long *map);
|
||||
extern int __frontswap_store(struct page *page);
|
||||
extern int __frontswap_load(struct page *page);
|
||||
extern void __frontswap_invalidate_page(unsigned, pgoff_t);
|
||||
|
@ -98,10 +98,10 @@ static inline void frontswap_invalidate_area(unsigned type)
|
|||
__frontswap_invalidate_area(type);
|
||||
}
|
||||
|
||||
static inline void frontswap_init(unsigned type)
|
||||
static inline void frontswap_init(unsigned type, unsigned long *map)
|
||||
{
|
||||
if (frontswap_enabled)
|
||||
__frontswap_init(type);
|
||||
__frontswap_init(type, map);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_FRONTSWAP_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue