All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Dan Streetman <ddstreet@ieee.org>
Cc: "Seth Jennings" <sjenning@redhat.com>,
	Linux-MM <linux-mm@kvack.org>,
	"Vitaly Wool" <vitalywool@gmail.com>,
	"Marcin Mirosław" <marcin@mejor.pl>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Sergey Senozhatsky" <sergey.senozhatsky.work@gmail.com>,
	"Sergey Senozhatsky" <sergey.senozhatsky@gmail.com>
Subject: Re: Choosing z3fold allocator in zswap gives WARNING: CPU: 0 PID: 5140 at mm/zswap.c:503 __zswap_pool_current+0x56/0x60
Date: Fri, 5 Aug 2016 10:22:12 +0900	[thread overview]
Message-ID: <20160805012212.GB514@swordfish> (raw)
In-Reply-To: <20160805004357.GA514@swordfish>

On (08/05/16 09:43), Sergey Senozhatsky wrote:
> On (08/04/16 14:15), Dan Streetman wrote:
> [..]
> >    yep that's exactly right.  I reproduced it with zbud compiled out.
> [..]
> >    yep that's true as well.
> >    i can get patches going for both these, unless you're already working on
> >    it?
> 
> please go ahead.

while at it.

__zswap_param_set():

	pool = zswap_pool_find_get(type, compressor);
	if (pool) {
		zswap_pool_debug("using existing", pool);
		list_del_rcu(&pool->list);
	} else {
		spin_unlock(&zswap_pools_lock);
		pool = zswap_pool_create(type, compressor);
		spin_lock(&zswap_pools_lock);
	}

	if (pool)
		ret = param_set_charp(s, kp);
	else
		ret = -EINVAL;

	if (!ret) {
		put_pool = zswap_pool_current();
		list_add_rcu(&pool->list, &zswap_pools);
	} else if (pool) {
		/* add the possibly pre-existing pool to the end of the pools
		 * list; if it's new (and empty) then it'll be removed and
		 * destroyed by the put after we drop the lock
		 */
		list_add_tail_rcu(&pool->list, &zswap_pools);
		put_pool = pool;
	}

this can be simplified, I think.

suppose there is no zswap_pool_find_get() pool. so we try to
zswap_pool_create() one, but it doesn't go well. at this point
we basically can just return -ENOMEM

	spin_unlock(&zswap_pools_lock);
	pool = zswap_pool_create(type, compressor);
	if (!pool)
		return -ENOMEM;
	spin_lock(&zswap_pools_lock);

so some of later if-s can go away.

	-ss

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-08-05  1:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01  9:03 Choosing z3fold allocator in zswap gives WARNING: CPU: 0 PID: 5140 at mm/zswap.c:503 __zswap_pool_current+0x56/0x60 Marcin Mirosław
2016-08-01  9:08 ` Vitaly Wool
2016-08-01  9:21   ` Marcin Mirosław
2016-08-02  9:13     ` Vitaly Wool
2016-08-02  9:52       ` Marcin Mirosław
2016-08-04 11:58 ` Sergey Senozhatsky
2016-08-04 18:15   ` Dan Streetman
2016-08-05  0:43     ` Sergey Senozhatsky
2016-08-05  1:22       ` Sergey Senozhatsky [this message]
2016-08-07 22:40   ` Vitaly Wool

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=20160805012212.GB514@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=linux-mm@kvack.org \
    --cc=marcin@mejor.pl \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=sjenning@redhat.com \
    --cc=vitalywool@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.