Re: Choosing z3fold allocator in zswap gives WARNING: CPU: 0 PID: 5140 at mm/zswap.c:503 __zswap_pool_current+0x56/0x60

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]