mm/zbud: init user ops only when it is needed

When zbud is initialized through the zpool wrapper, pool->ops which
points to user-defined operations is always set regardless of whether it
is specified from the upper layer. This causes zbud_reclaim_page() to
iterate its loop for evicting pool pages out without any gain.

This patch sets the user-defined ops only when it is needed, so that
zbud_reclaim_page() can bail out the reclamation loop earlier if there
is no user-defined operations specified.

Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Acked-by: Dan Streetman <ddstreet@ieee.org>
Cc: Seth Jennings <sjennings@variantweb.net>
Cc: Sunae Seo <sunae.seo@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Heesub Shin 2014-12-12 16:57:21 -08:00 committed by Linus Torvalds
parent 442cc432e6
commit 1dd61aa31c
1 changed files with 1 additions and 1 deletions

View File

@ -132,7 +132,7 @@ static struct zbud_ops zbud_zpool_ops = {
static void *zbud_zpool_create(gfp_t gfp, struct zpool_ops *zpool_ops) static void *zbud_zpool_create(gfp_t gfp, struct zpool_ops *zpool_ops)
{ {
return zbud_create_pool(gfp, &zbud_zpool_ops); return zbud_create_pool(gfp, zpool_ops ? &zbud_zpool_ops : NULL);
} }
static void zbud_zpool_destroy(void *pool) static void zbud_zpool_destroy(void *pool)