diff options
author | Cesar Eduardo Barros <cesarb@cesarb.net> | 2011-03-22 19:33:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:08 -0400 |
commit | c69dbfb84e88503468b6c481aecdb48d76ad5bc6 (patch) | |
tree | ade74b75b80a0481ae6309c9cb0bc7298db13ad7 /mm/swapfile.c | |
parent | 9c8100ef26ba9012b8677a383179a0cf169fc7f3 (diff) |
sys_swapon: move printk outside lock
The block in sys_swapon which does the final adjustments to the
swap_info_struct and to swap_list is the same as the block which
re-inserts it again at sys_swapoff on failure of try_to_unuse(). To be
able to make both share the same code, move the printk() call in the
middle of it to just after it.
Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Tested-by: Eric B Munson <emunson@mgebm.net>
Acked-by: Eric B Munson <emunson@mgebm.net>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index 9e3613b91612..df3dc7a3c2e2 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -2144,13 +2144,6 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) | |||
2144 | nr_swap_pages += p->pages; | 2144 | nr_swap_pages += p->pages; |
2145 | total_swap_pages += p->pages; | 2145 | total_swap_pages += p->pages; |
2146 | 2146 | ||
2147 | printk(KERN_INFO "Adding %uk swap on %s. " | ||
2148 | "Priority:%d extents:%d across:%lluk %s%s\n", | ||
2149 | p->pages<<(PAGE_SHIFT-10), name, p->prio, | ||
2150 | nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10), | ||
2151 | (p->flags & SWP_SOLIDSTATE) ? "SS" : "", | ||
2152 | (p->flags & SWP_DISCARDABLE) ? "D" : ""); | ||
2153 | |||
2154 | /* insert swap space into swap_list: */ | 2147 | /* insert swap space into swap_list: */ |
2155 | prev = -1; | 2148 | prev = -1; |
2156 | for (i = swap_list.head; i >= 0; i = swap_info[i]->next) { | 2149 | for (i = swap_list.head; i >= 0; i = swap_info[i]->next) { |
@@ -2164,6 +2157,14 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) | |||
2164 | else | 2157 | else |
2165 | swap_info[prev]->next = p->type; | 2158 | swap_info[prev]->next = p->type; |
2166 | spin_unlock(&swap_lock); | 2159 | spin_unlock(&swap_lock); |
2160 | |||
2161 | printk(KERN_INFO "Adding %uk swap on %s. " | ||
2162 | "Priority:%d extents:%d across:%lluk %s%s\n", | ||
2163 | p->pages<<(PAGE_SHIFT-10), name, p->prio, | ||
2164 | nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10), | ||
2165 | (p->flags & SWP_SOLIDSTATE) ? "SS" : "", | ||
2166 | (p->flags & SWP_DISCARDABLE) ? "D" : ""); | ||
2167 | |||
2167 | mutex_unlock(&swapon_mutex); | 2168 | mutex_unlock(&swapon_mutex); |
2168 | atomic_inc(&proc_poll_event); | 2169 | atomic_inc(&proc_poll_event); |
2169 | wake_up_interruptible(&proc_poll_wait); | 2170 | wake_up_interruptible(&proc_poll_wait); |