linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Cesar Eduardo Barros <cesarb@cesarb.net>
Cc: linux-kernel@vger.kernel.org,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	linux-mm@kvack.org
Subject: Re: frontswap: is frontswap_init called from swapoff safe?
Date: Wed, 6 Jun 2012 20:37:20 -0400	[thread overview]
Message-ID: <20120607003720.GI9472@phenom.dumpdata.com> (raw)
In-Reply-To: <4FCDE270.1020906@cesarb.net>

On Tue, Jun 05, 2012 at 07:41:52AM -0300, Cesar Eduardo Barros wrote:
> I was looking at the swapfile.c parts of the recently-merged
> frontswap, and noticed that frontswap_init can be called from
> swapoff when try_to_unuse fails.
> 
> This looks odd to me. Whether it is safe or not depends on what
> frontswap_ops.init does, but the comment for __frontswap_init
> ("Called when a swap device is swapon'd") and the function name
> itself seem to imply it should be called only for swapon, not when
> relinking the swap_info after a failed swapoff.

<nods>
> 
> In particular, if frontswap_ops.init assumes the swap map is empty,
> it would break, since as far as I know when try_to_unuse fails there
> are still pages in the swap.

Let me look at this - can't do it this week - but will get back to you
shortly.
> 
> (By the way, the comment above enable_swap_info at sys_swapoff needs
> to be updated to also explain why reading p->frontswap_map outside
> the lock is safe at that point, like it does for p->prio and
> p->swap_map.)
> 
> -- 
> Cesar Eduardo Barros
> cesarb@cesarb.net
> cesar.barros@gmail.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-06-07  0:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05 10:41 frontswap: is frontswap_init called from swapoff safe? Cesar Eduardo Barros
2012-06-07  0:37 ` Konrad Rzeszutek Wilk [this message]
2012-07-17  0:41   ` Cesar Eduardo Barros

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=20120607003720.GI9472@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=cesarb@cesarb.net \
    --cc=dan.magenheimer@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).