From: Jan Kara <jack@suse.cz>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, cl@linux-foundation.org,
Jan Kara <jack@suse.cz>, Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 2/3] proportions: add @gfp to init functions
Date: Tue, 26 Aug 2014 12:19:29 +0200 [thread overview]
Message-ID: <20140826101929.GE1581@quack.suse.cz> (raw)
In-Reply-To: <1409013812-21700-3-git-send-email-tj@kernel.org>
On Mon 25-08-14 20:43:31, Tejun Heo wrote:
> Percpu allocator now supports allocation mask. Add @gfp to
> [flex_]proportions init functions so that !GFP_KERNEL allocation masks
> can be used with them too.
>
> This patch doesn't make any functional difference.
Looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Peter Zijlstra <peterz@infradead.org>
> ---
> include/linux/flex_proportions.h | 5 +++--
> include/linux/proportions.h | 5 +++--
> lib/flex_proportions.c | 8 ++++----
> lib/proportions.c | 10 +++++-----
> mm/backing-dev.c | 2 +-
> mm/page-writeback.c | 2 +-
> 6 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h
> index 4ebc49f..0d348e0 100644
> --- a/include/linux/flex_proportions.h
> +++ b/include/linux/flex_proportions.h
> @@ -10,6 +10,7 @@
> #include <linux/percpu_counter.h>
> #include <linux/spinlock.h>
> #include <linux/seqlock.h>
> +#include <linux/gfp.h>
>
> /*
> * When maximum proportion of some event type is specified, this is the
> @@ -32,7 +33,7 @@ struct fprop_global {
> seqcount_t sequence;
> };
>
> -int fprop_global_init(struct fprop_global *p);
> +int fprop_global_init(struct fprop_global *p, gfp_t gfp);
> void fprop_global_destroy(struct fprop_global *p);
> bool fprop_new_period(struct fprop_global *p, int periods);
>
> @@ -79,7 +80,7 @@ struct fprop_local_percpu {
> raw_spinlock_t lock; /* Protect period and numerator */
> };
>
> -int fprop_local_init_percpu(struct fprop_local_percpu *pl);
> +int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp);
> void fprop_local_destroy_percpu(struct fprop_local_percpu *pl);
> void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl);
> void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl,
> diff --git a/include/linux/proportions.h b/include/linux/proportions.h
> index 26a8a4e..00e8e8f 100644
> --- a/include/linux/proportions.h
> +++ b/include/linux/proportions.h
> @@ -12,6 +12,7 @@
> #include <linux/percpu_counter.h>
> #include <linux/spinlock.h>
> #include <linux/mutex.h>
> +#include <linux/gfp.h>
>
> struct prop_global {
> /*
> @@ -40,7 +41,7 @@ struct prop_descriptor {
> struct mutex mutex; /* serialize the prop_global switch */
> };
>
> -int prop_descriptor_init(struct prop_descriptor *pd, int shift);
> +int prop_descriptor_init(struct prop_descriptor *pd, int shift, gfp_t gfp);
> void prop_change_shift(struct prop_descriptor *pd, int new_shift);
>
> /*
> @@ -61,7 +62,7 @@ struct prop_local_percpu {
> raw_spinlock_t lock; /* protect the snapshot state */
> };
>
> -int prop_local_init_percpu(struct prop_local_percpu *pl);
> +int prop_local_init_percpu(struct prop_local_percpu *pl, gfp_t gfp);
> void prop_local_destroy_percpu(struct prop_local_percpu *pl);
> void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl);
> void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl,
> diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c
> index b9d026b..8f25652 100644
> --- a/lib/flex_proportions.c
> +++ b/lib/flex_proportions.c
> @@ -34,13 +34,13 @@
> */
> #include <linux/flex_proportions.h>
>
> -int fprop_global_init(struct fprop_global *p)
> +int fprop_global_init(struct fprop_global *p, gfp_t gfp)
> {
> int err;
>
> p->period = 0;
> /* Use 1 to avoid dealing with periods with 0 events... */
> - err = percpu_counter_init(&p->events, 1, GFP_KERNEL);
> + err = percpu_counter_init(&p->events, 1, gfp);
> if (err)
> return err;
> seqcount_init(&p->sequence);
> @@ -168,11 +168,11 @@ void fprop_fraction_single(struct fprop_global *p,
> */
> #define PROP_BATCH (8*(1+ilog2(nr_cpu_ids)))
>
> -int fprop_local_init_percpu(struct fprop_local_percpu *pl)
> +int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp)
> {
> int err;
>
> - err = percpu_counter_init(&pl->events, 0, GFP_KERNEL);
> + err = percpu_counter_init(&pl->events, 0, gfp);
> if (err)
> return err;
> pl->period = 0;
> diff --git a/lib/proportions.c b/lib/proportions.c
> index ca95f8d..6f72429 100644
> --- a/lib/proportions.c
> +++ b/lib/proportions.c
> @@ -73,7 +73,7 @@
> #include <linux/proportions.h>
> #include <linux/rcupdate.h>
>
> -int prop_descriptor_init(struct prop_descriptor *pd, int shift)
> +int prop_descriptor_init(struct prop_descriptor *pd, int shift, gfp_t gfp)
> {
> int err;
>
> @@ -83,11 +83,11 @@ int prop_descriptor_init(struct prop_descriptor *pd, int shift)
> pd->index = 0;
> pd->pg[0].shift = shift;
> mutex_init(&pd->mutex);
> - err = percpu_counter_init(&pd->pg[0].events, 0, GFP_KERNEL);
> + err = percpu_counter_init(&pd->pg[0].events, 0, gfp);
> if (err)
> goto out;
>
> - err = percpu_counter_init(&pd->pg[1].events, 0, GFP_KERNEL);
> + err = percpu_counter_init(&pd->pg[1].events, 0, gfp);
> if (err)
> percpu_counter_destroy(&pd->pg[0].events);
>
> @@ -188,12 +188,12 @@ prop_adjust_shift(int *pl_shift, unsigned long *pl_period, int new_shift)
>
> #define PROP_BATCH (8*(1+ilog2(nr_cpu_ids)))
>
> -int prop_local_init_percpu(struct prop_local_percpu *pl)
> +int prop_local_init_percpu(struct prop_local_percpu *pl, gfp_t gfp)
> {
> raw_spin_lock_init(&pl->lock);
> pl->shift = 0;
> pl->period = 0;
> - return percpu_counter_init(&pl->events, 0, GFP_KERNEL);
> + return percpu_counter_init(&pl->events, 0, gfp);
> }
>
> void prop_local_destroy_percpu(struct prop_local_percpu *pl)
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index f19a818..64ec49d 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -470,7 +470,7 @@ int bdi_init(struct backing_dev_info *bdi)
> bdi->write_bandwidth = INIT_BW;
> bdi->avg_write_bandwidth = INIT_BW;
>
> - err = fprop_local_init_percpu(&bdi->completions);
> + err = fprop_local_init_percpu(&bdi->completions, GFP_KERNEL);
>
> if (err) {
> err:
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 91d73ef..5085994 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -1777,7 +1777,7 @@ void __init page_writeback_init(void)
> writeback_set_ratelimit();
> register_cpu_notifier(&ratelimit_nb);
>
> - fprop_global_init(&writeout_completions);
> + fprop_global_init(&writeout_completions, GFP_KERNEL);
> }
>
> /**
> --
> 1.9.3
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2014-08-26 10:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 0:43 [PATCHSET percpu/for-3.18] add @gfp to init functions of percpu data structures Tejun Heo
2014-08-26 0:43 ` [PATCH 1/3] percpu_counter: add @gfp to percpu_counter_init() Tejun Heo
2014-08-26 0:46 ` David Miller
2014-08-26 10:21 ` Jan Kara
2014-08-26 0:43 ` [PATCH 2/3] proportions: add @gfp to init functions Tejun Heo
2014-08-26 10:19 ` Jan Kara [this message]
2014-08-26 0:43 ` [PATCH 3/3] percpu-refcount: add @gfp to percpu_ref_init() Tejun Heo
2014-08-26 15:35 ` [PATCH v2 " Tejun Heo
2014-09-08 0:30 ` [PATCH 0.5/3] percpu_counter: make percpu_counters_lock irq-safe Tejun Heo
2014-09-08 0:30 ` [PATCHSET percpu/for-3.18] add @gfp to init functions of percpu data structures Tejun Heo
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=20140826101929.GE1581@quack.suse.cz \
--to=jack@suse.cz \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®