From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756616Ab3A0VrC (ORCPT ); Sun, 27 Jan 2013 16:47:02 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:43310 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756545Ab3A0VrA (ORCPT ); Sun, 27 Jan 2013 16:47:00 -0500 Date: Sun, 27 Jan 2013 13:47:01 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Shaohua Li cc: Andrew Morton , Sasha Levin , Shaohua Li , Rik van Riel , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH next/mmotm] swap: add per-partition lock for swapfile fix In-Reply-To: <20130127141253.GA27019@kernel.org> Message-ID: References: <5101FFF5.6030503@oracle.com> <20130125042512.GA32017@kernel.org> <20130127141253.GA27019@kernel.org> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I had all cpus spinning in swap_info_get(), for the lock on an area being swapped off: probably because get_swap_page() forgot to unlock. Signed-off-by: Hugh Dickins --- mm/swapfile.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- mmotm.orig/mm/swapfile.c 2013-01-23 17:55:39.132447115 -0800 +++ mmotm/mm/swapfile.c 2013-01-27 10:41:45.000000000 -0800 @@ -470,10 +470,9 @@ swp_entry_t get_swap_page(void) spin_unlock(&swap_lock); /* This is called for allocating swap entry for cache */ offset = scan_swap_map(si, SWAP_HAS_CACHE); - if (offset) { - spin_unlock(&si->lock); + spin_unlock(&si->lock); + if (offset) return swp_entry(type, offset); - } spin_lock(&swap_lock); next = swap_list.next; }