Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8028892c authored by Vinayak Menon's avatar Vinayak Menon Committed by Gerrit - the friendly Code Review server
Browse files

mm: zcache: disallow sleep in zcache store



zcache store ops cannot sleep since it is called from
an atomic context. Pass the right flags to alloc functions.

Change-Id: I9c7956e895fb7909932315aa3d85845127aa02e1
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
parent a43960d3
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ static u64 zcache_inactive_pages_refused;
static u64 zcache_reclaim_fail;
static atomic_t zcache_stored_pages = ATOMIC_INIT(0);

#define GFP_ZCACHE \
	(__GFP_FS | __GFP_NORETRY | __GFP_NOWARN | __GFP_NOMEMALLOC)
/*
 * Zcache receives pages for compression through the Cleancache API and is able
 * to evict pages from its own compressed pool on an LRU basis in the case that
@@ -406,7 +408,8 @@ static int zcache_store_zaddr(struct zcache_pool *zpool,
	rbnode = zcache_find_get_rbnode(zpool, zhandle->rb_index);
	if (!rbnode) {
		/* alloc and init a new rbnode */
		rbnode = kmem_cache_alloc(zcache_rbnode_cache, GFP_KERNEL);
		rbnode = kmem_cache_alloc(zcache_rbnode_cache,
			GFP_ZCACHE);
		if (!rbnode)
			return -ENOMEM;

@@ -535,7 +538,7 @@ static void zcache_store_page(int pool_id, struct cleancache_filekey key,

	/* store zcache handle together with compressed page data */
	ret = zbud_alloc(zpool->pool, zlen + sizeof(struct zcache_ra_handle),
			__GFP_NORETRY | __GFP_NOWARN, &zaddr);
			GFP_ZCACHE, &zaddr);
	if (ret) {
		zcache_zbud_alloc_fail++;
		put_cpu_var(zcache_dstmem);