From: Cesar Eduardo Barros Date: Wed, 12 Dec 2012 00:01:13 +0000 (-0800) Subject: mm: refactor reinsert of swap_info in sys_swapoff() X-Git-Tag: omap-for-v3.8/fixes-for-merge-window-v4-signed~81^2~47 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf0cac0a09341549dedabcfc2a66dcbc2eaaf2b9;p=pandora-kernel.git mm: refactor reinsert of swap_info in sys_swapoff() The block within sys_swapoff() which re-inserts the swap_info into the swap_list in case of failure of try_to_unuse() reads a few values outside the swap_lock. While this is safe at that point, it is subtle code. Simplify the code by moving the reading of these values to a separate function, refactoring it a bit so they are read from within the swap_lock. This is easier to understand, and matches better the way it worked before I unified the insertion of the swap_info from both sys_swapon and sys_swapoff. This change should make no functional difference. The only real change is moving the read of two or three structure fields to within the lock (frontswap_map_get() is nothing more than a read of p->frontswap_map). Signed-off-by: Cesar Eduardo Barros Cc: Konrad Rzeszutek Wilk Cc: Dan Magenheimer Cc: Mel Gorman Cc: Rik van Riel Cc: KAMEZAWA Hiroyuki Cc: Johannes Weiner Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed