linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Shaohua Li <shli@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Sasha Levin <sasha.levin@oracle.com>,
	Shaohua Li <shli@fusionio.com>, Rik van Riel <riel@redhat.com>,
	Minchan Kim <minchan@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH next/mmotm] swap: add per-partition lock for swapfile fix
Date: Sun, 27 Jan 2013 13:47:01 -0800 (PST)	[thread overview]
Message-ID: <alpine.LNX.2.00.1301271341030.16981@eggly.anvils> (raw)
In-Reply-To: <20130127141253.GA27019@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 <hughd@google.com>
---

 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;
 	}

  parent reply	other threads:[~2013-01-27 21:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25  3:45 boot warnings due to swap: make each swap partition have one address_space Sasha Levin
2013-01-25  4:25 ` Shaohua Li
2013-01-25 23:37   ` Sasha Levin
2013-01-27  2:16   ` Hugh Dickins
2013-01-27 14:12     ` Shaohua Li
2013-01-27 21:40       ` Hugh Dickins
2013-01-29 15:56         ` Valdis.Kletnieks
2013-01-30  9:59         ` Shaohua Li
2013-02-04  5:12           ` Hugh Dickins
2013-01-27 21:47       ` Hugh Dickins [this message]
2013-01-28  0:07         ` [PATCH next/mmotm] swap: add per-partition lock for swapfile fix Shaohua Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1301271341030.16981@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=riel@redhat.com \
    --cc=sasha.levin@oracle.com \
    --cc=shli@fusionio.com \
    --cc=shli@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).