• Minchan Kim's avatar
    frontswap: get rid of swap_lock dependency · 4f89849d
    Minchan Kim authored
    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: default avatarMinchan 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: default avatarKonrad Rzeszutek Wilk <konrad@darnok.org>
    Signed-off-by: default avatarBob 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: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    4f89849d
swapfile.c 65.6 KB