From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Dan Streetman <ddstreet@ieee.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Seth Jennings <sjennings@variantweb.net>,
Andrew Morton <akpm@linux-foundation.org>,
Linux-MM <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] zswap: dynamic pool creation
Date: Mon, 10 Aug 2015 09:49:12 +0900 [thread overview]
Message-ID: <20150810004912.GB645@swordfish> (raw)
In-Reply-To: <CALZtONATwf7EbWo1RhoNzeYnacCk6A__9Jrtr4UZvV9W-seX7g@mail.gmail.com>
Hello,
On (08/07/15 10:24), Dan Streetman wrote:
> > On (08/05/15 09:46), Dan Streetman wrote:
> > [..]
> >> -enum comp_op {
> >> - ZSWAP_COMPOP_COMPRESS,
> >> - ZSWAP_COMPOP_DECOMPRESS
> >> +struct zswap_pool {
> >> + struct zpool *zpool;
> >> + struct kref kref;
> >> + struct list_head list;
> >> + struct rcu_head rcu_head;
> >> + struct notifier_block notifier;
> >> + char tfm_name[CRYPTO_MAX_ALG_NAME];
> >
> > do you need to keep a second CRYPTO_MAX_ALG_NAME copy? shouldn't it
> > be `tfm->__crt_alg->cra_name`, which is what
> > crypto_tfm_alg_name(struct crypto_tfm *tfm)
> > does?
>
> well, we don't absolutely have to keep a copy of tfm_name. However,
> ->tfm is a __percpu variable, so each time we want to check the pool's
> tfm name, we would need to do:
> crypto_comp_name(this_cpu_ptr(pool->tfm))
>
> nothing wrong with that really, just adds a bit more code each time we
> want to check the tfm name. I'll send a patch to change it.
>
> >
> >> + struct crypto_comp * __percpu *tfm;
> >> };
> >
> > ->tfm will be access pretty often, right? did you intentionally put it
> > at the bottom offset of `struct zswap_pool'?
>
> no it wasn't intentional; does moving it up provide a benefit?
well, I just prefer to keep 'read mostly' pointers together. all
those cache lines, etc.
gcc 5.1, x86_64
struct zswap_pool {
struct zpool *zpool;
+ struct crypto_comp * __percpu *tfm;
struct kref kref;
struct list_head list;
struct rcu_head rcu_head;
struct notifier_block notifier;
char tfm_name[CRYPTO_MAX_ALG_NAME];
- struct crypto_comp * __percpu *tfm;
};
../scripts/bloat-o-meter zswap.o.old zswap.o
add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-27 (-27)
function old new delta
zswap_writeback_entry 659 656 -3
zswap_frontswap_store 1445 1442 -3
zswap_frontswap_load 417 414 -3
zswap_pool_create 438 432 -6
__zswap_cpu_comp_notifier.part 152 146 -6
__zswap_cpu_comp_notifier 122 116 -6
you know it better ;-)
[..]
> > this one seems to be used only once. do you want to replace
> > that single usage (well, if it's really needed)
>
> it's actually used twice, in __zswap_pool_empty() and
> __zswap_param_set(). The next patch adds __zswap_param_set().
Aha, sorry, didn't read the next patch in advance.
-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>
WARNING: multiple messages have this Message-ID (diff)
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Dan Streetman <ddstreet@ieee.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Seth Jennings <sjennings@variantweb.net>,
Andrew Morton <akpm@linux-foundation.org>,
Linux-MM <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] zswap: dynamic pool creation
Date: Mon, 10 Aug 2015 09:49:12 +0900 [thread overview]
Message-ID: <20150810004912.GB645@swordfish> (raw)
In-Reply-To: <CALZtONATwf7EbWo1RhoNzeYnacCk6A__9Jrtr4UZvV9W-seX7g@mail.gmail.com>
Hello,
On (08/07/15 10:24), Dan Streetman wrote:
> > On (08/05/15 09:46), Dan Streetman wrote:
> > [..]
> >> -enum comp_op {
> >> - ZSWAP_COMPOP_COMPRESS,
> >> - ZSWAP_COMPOP_DECOMPRESS
> >> +struct zswap_pool {
> >> + struct zpool *zpool;
> >> + struct kref kref;
> >> + struct list_head list;
> >> + struct rcu_head rcu_head;
> >> + struct notifier_block notifier;
> >> + char tfm_name[CRYPTO_MAX_ALG_NAME];
> >
> > do you need to keep a second CRYPTO_MAX_ALG_NAME copy? shouldn't it
> > be `tfm->__crt_alg->cra_name`, which is what
> > crypto_tfm_alg_name(struct crypto_tfm *tfm)
> > does?
>
> well, we don't absolutely have to keep a copy of tfm_name. However,
> ->tfm is a __percpu variable, so each time we want to check the pool's
> tfm name, we would need to do:
> crypto_comp_name(this_cpu_ptr(pool->tfm))
>
> nothing wrong with that really, just adds a bit more code each time we
> want to check the tfm name. I'll send a patch to change it.
>
> >
> >> + struct crypto_comp * __percpu *tfm;
> >> };
> >
> > ->tfm will be access pretty often, right? did you intentionally put it
> > at the bottom offset of `struct zswap_pool'?
>
> no it wasn't intentional; does moving it up provide a benefit?
well, I just prefer to keep 'read mostly' pointers together. all
those cache lines, etc.
gcc 5.1, x86_64
struct zswap_pool {
struct zpool *zpool;
+ struct crypto_comp * __percpu *tfm;
struct kref kref;
struct list_head list;
struct rcu_head rcu_head;
struct notifier_block notifier;
char tfm_name[CRYPTO_MAX_ALG_NAME];
- struct crypto_comp * __percpu *tfm;
};
../scripts/bloat-o-meter zswap.o.old zswap.o
add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-27 (-27)
function old new delta
zswap_writeback_entry 659 656 -3
zswap_frontswap_store 1445 1442 -3
zswap_frontswap_load 417 414 -3
zswap_pool_create 438 432 -6
__zswap_cpu_comp_notifier.part 152 146 -6
__zswap_cpu_comp_notifier 122 116 -6
you know it better ;-)
[..]
> > this one seems to be used only once. do you want to replace
> > that single usage (well, if it's really needed)
>
> it's actually used twice, in __zswap_pool_empty() and
> __zswap_param_set(). The next patch adds __zswap_param_set().
Aha, sorry, didn't read the next patch in advance.
-ss
next prev parent reply other threads:[~2015-08-10 0:48 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 13:46 [PATCH 0/3] make zswap params changeable at runtime Dan Streetman
2015-08-05 13:46 ` Dan Streetman
2015-08-05 13:46 ` [PATCH 1/3] zpool: add zpool_has_pool() Dan Streetman
2015-08-05 13:46 ` Dan Streetman
2015-08-05 20:08 ` Andrew Morton
2015-08-05 20:08 ` Andrew Morton
2015-08-05 22:00 ` Dan Streetman
2015-08-05 22:00 ` Dan Streetman
2015-08-05 22:06 ` Andrew Morton
2015-08-05 22:06 ` Andrew Morton
2015-08-06 21:50 ` Seth Jennings
2015-08-06 21:50 ` Seth Jennings
2015-08-07 3:30 ` Seth Jennings
2015-08-07 3:30 ` Seth Jennings
2015-08-14 20:01 ` Dan Streetman
2015-08-14 20:01 ` Dan Streetman
2015-08-06 17:54 ` [PATCH] zpool: clarification comment for zpool_has_pool Dan Streetman
2015-08-06 17:54 ` Dan Streetman
2015-08-05 13:46 ` [PATCH 2/3] zswap: dynamic pool creation Dan Streetman
2015-08-05 13:46 ` Dan Streetman
2015-08-07 6:30 ` Sergey Senozhatsky
2015-08-07 6:30 ` Sergey Senozhatsky
2015-08-07 14:24 ` Dan Streetman
2015-08-07 14:24 ` Dan Streetman
2015-08-07 18:57 ` Dan Streetman
2015-08-07 18:57 ` Dan Streetman
2015-08-10 0:49 ` Sergey Senozhatsky [this message]
2015-08-10 0:49 ` Sergey Senozhatsky
2015-08-14 20:02 ` Dan Streetman
2015-08-14 20:02 ` Dan Streetman
2015-08-05 13:46 ` [PATCH 3/3] zswap: change zpool/compressor at runtime Dan Streetman
2015-08-05 13:46 ` Dan Streetman
2015-08-05 20:14 ` Andrew Morton
2015-08-05 20:14 ` Andrew Morton
2015-08-06 10:06 ` Dan Streetman
2015-08-06 10:06 ` Dan Streetman
2015-08-06 17:54 ` [PATCH] zswap: comment clarifying maxlen Dan Streetman
2015-08-06 17:54 ` Dan Streetman
2015-08-06 0:08 ` [PATCH 3/3] zswap: change zpool/compressor at runtime Sergey Senozhatsky
2015-08-06 0:08 ` Sergey Senozhatsky
2015-08-06 10:20 ` Dan Streetman
2015-08-06 10:20 ` Dan Streetman
2015-08-06 10:59 ` Sergey Senozhatsky
2015-08-06 10:59 ` Sergey Senozhatsky
2015-08-06 11:07 ` Dan Streetman
2015-08-06 11:07 ` 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=20150810004912.GB645@swordfish \
--to=sergey.senozhatsky.work@gmail.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 \
/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.