mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
swap_info: note SWAP_MAP_SHMEM
While we're fiddling with the swap_map values, let's assign a particular value to shmem/tmpfs swap pages: their swap counts are never incremented, and it helps swapoff's try_to_unuse() a little if it can immediately distinguish those pages from process pages. Since we've no use for SWAP_MAP_BAD | COUNT_CONTINUED, we might as well use that 0xbf value for SWAP_MAP_SHMEM. Signed-off-by: Hugh Dickins <[email protected]> Reviewed-by: KAMEZAWA Hiroyuki <[email protected]> Cc: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
570a335b8e
commit
aaa468653b
3 changed files with 42 additions and 22 deletions
11
mm/shmem.c
11
mm/shmem.c
|
|
@ -1017,7 +1017,14 @@ int shmem_unuse(swp_entry_t entry, struct page *page)
|
|||
goto out;
|
||||
}
|
||||
mutex_unlock(&shmem_swaplist_mutex);
|
||||
out: return found; /* 0 or 1 or -ENOMEM */
|
||||
/*
|
||||
* Can some race bring us here? We've been holding page lock,
|
||||
* so I think not; but would rather try again later than BUG()
|
||||
*/
|
||||
unlock_page(page);
|
||||
page_cache_release(page);
|
||||
out:
|
||||
return (found < 0) ? found : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1080,7 +1087,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
|
|||
else
|
||||
inode = NULL;
|
||||
spin_unlock(&info->lock);
|
||||
swap_duplicate(swap);
|
||||
swap_shmem_alloc(swap);
|
||||
BUG_ON(page_mapped(page));
|
||||
page_cache_release(page); /* pagecache ref */
|
||||
swap_writepage(page, wbc);
|
||||
|
|
|
|||
Loading…
Reference in a new issue