From: Heesub Shin <heesub.shin@samsung.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Streetman <ddstreet@ieee.org>,
Seth Jennings <sjennings@variantweb.net>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Sunae Seo <sunae.seo@samsung.com>
Subject: Re: [PATCH] mm/zbud: init user ops only when it is needed
Date: Thu, 16 Oct 2014 14:48:42 +0900 [thread overview]
Message-ID: <543F5C3A.1070503@samsung.com> (raw)
In-Reply-To: <20141015131710.ffd6c40996cd1ce6c16dbae8@linux-foundation.org>
Hello,
On 10/16/2014 05:17 AM, Andrew Morton wrote:
> On Wed, 15 Oct 2014 19:00:43 +0900 Heesub Shin <heesub.shin@samsung.com> wrote:
>
>> 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.
>
> Which callsite is calling zbud_zpool_create(..., NULL)?
Currently nowhere. zswap is the only user of zbud and always passes a
pointer to user-defined operation on pool creation. In addition, there
may be less possibility that pool shrinking is requested by users who
did not provide the user-defined ops. So, we may not need to worry much
about what I wrote in the changelog. However, it is definitely weird to
pass an argument, zpool_ops, which even will not be referenced by
zbud_zpool_create(). Above all, it would be more useful to avoid the
possibility in the future rather than just ignoring it.
regards,
heesub
>
>> ...
>> --- a/mm/zbud.c
>> +++ b/mm/zbud.c
>> @@ -132,7 +132,7 @@ static struct zbud_ops zbud_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)
>
>
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Heesub Shin <heesub.shin@samsung.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Streetman <ddstreet@ieee.org>,
Seth Jennings <sjennings@variantweb.net>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Sunae Seo <sunae.seo@samsung.com>
Subject: Re: [PATCH] mm/zbud: init user ops only when it is needed
Date: Thu, 16 Oct 2014 14:48:42 +0900 [thread overview]
Message-ID: <543F5C3A.1070503@samsung.com> (raw)
In-Reply-To: <20141015131710.ffd6c40996cd1ce6c16dbae8@linux-foundation.org>
Hello,
On 10/16/2014 05:17 AM, Andrew Morton wrote:
> On Wed, 15 Oct 2014 19:00:43 +0900 Heesub Shin <heesub.shin@samsung.com> wrote:
>
>> 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.
>
> Which callsite is calling zbud_zpool_create(..., NULL)?
Currently nowhere. zswap is the only user of zbud and always passes a
pointer to user-defined operation on pool creation. In addition, there
may be less possibility that pool shrinking is requested by users who
did not provide the user-defined ops. So, we may not need to worry much
about what I wrote in the changelog. However, it is definitely weird to
pass an argument, zpool_ops, which even will not be referenced by
zbud_zpool_create(). Above all, it would be more useful to avoid the
possibility in the future rather than just ignoring it.
regards,
heesub
>
>> ...
>> --- a/mm/zbud.c
>> +++ b/mm/zbud.c
>> @@ -132,7 +132,7 @@ static struct zbud_ops zbud_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)
>
>
next prev parent reply other threads:[~2014-10-16 5:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 10:00 [PATCH] mm/zbud: init user ops only when it is needed Heesub Shin
2014-10-15 10:00 ` Heesub Shin
2014-10-15 20:17 ` Andrew Morton
2014-10-15 20:17 ` Andrew Morton
2014-10-16 5:48 ` Heesub Shin [this message]
2014-10-16 5:48 ` Heesub Shin
2014-10-18 13:57 ` Dan Streetman
2014-10-18 13:57 ` Dan Streetman
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=543F5C3A.1070503@samsung.com \
--to=heesub.shin@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sjennings@variantweb.net \
--cc=sunae.seo@samsung.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.