From: Josef Bacik <josef@toxicpanda.com> To: hannes@cmpxchg.org, linux-mm@kvack.org, akpm@linux-foundation.org, jack@suse.cz, linux-fsdevel@vger.kernel.org, kernel-team@fb.com, linux-btrfs@vger.kernel.org Cc: Josef Bacik <jbacik@fb.com> Subject: [PATCH v3 03/10] lib: add a __fprop_add_percpu_max Date: Mon, 11 Dec 2017 16:55:28 -0500 [thread overview] Message-ID: <1513029335-5112-4-git-send-email-josef@toxicpanda.com> (raw) In-Reply-To: <1513029335-5112-1-git-send-email-josef@toxicpanda.com> From: Josef Bacik <jbacik@fb.com> This helper allows us to add an arbitrary amount to the fprop structures. Signed-off-by: Josef Bacik <jbacik@fb.com> --- include/linux/flex_proportions.h | 11 +++++++++-- lib/flex_proportions.c | 9 +++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h index 0d348e011a6e..9f88684bf0a0 100644 --- a/include/linux/flex_proportions.h +++ b/include/linux/flex_proportions.h @@ -83,8 +83,8 @@ struct fprop_local_percpu { 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, - int max_frac); +void __fprop_add_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl, + unsigned long nr, int max_frac); void fprop_fraction_percpu(struct fprop_global *p, struct fprop_local_percpu *pl, unsigned long *numerator, unsigned long *denominator); @@ -99,4 +99,11 @@ void fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl) local_irq_restore(flags); } +static inline +void __fprop_inc_percpu_max(struct fprop_global *p, + struct fprop_local_percpu *pl, int max_frac) +{ + __fprop_add_percpu_max(p, pl, 1, max_frac); +} + #endif diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index 2cc1f94e03a1..31003989d34a 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c @@ -255,8 +255,9 @@ void fprop_fraction_percpu(struct fprop_global *p, * Like __fprop_inc_percpu() except that event is counted only if the given * type has fraction smaller than @max_frac/FPROP_FRAC_BASE */ -void __fprop_inc_percpu_max(struct fprop_global *p, - struct fprop_local_percpu *pl, int max_frac) +void __fprop_add_percpu_max(struct fprop_global *p, + struct fprop_local_percpu *pl, unsigned long nr, + int max_frac) { if (unlikely(max_frac < FPROP_FRAC_BASE)) { unsigned long numerator, denominator; @@ -267,6 +268,6 @@ void __fprop_inc_percpu_max(struct fprop_global *p, return; } else fprop_reflect_period_percpu(p, pl); - percpu_counter_add_batch(&pl->events, 1, PROP_BATCH); - percpu_counter_add(&p->events, 1); + percpu_counter_add_batch(&pl->events, nr, PROP_BATCH); + percpu_counter_add(&p->events, nr); } -- 2.7.5
WARNING: multiple messages have this Message-ID (diff)
From: Josef Bacik <josef@toxicpanda.com> To: hannes@cmpxchg.org, linux-mm@kvack.org, akpm@linux-foundation.org, jack@suse.cz, linux-fsdevel@vger.kernel.org, kernel-team@fb.com, linux-btrfs@vger.kernel.org Cc: Josef Bacik <jbacik@fb.com> Subject: [PATCH v3 03/10] lib: add a __fprop_add_percpu_max Date: Mon, 11 Dec 2017 16:55:28 -0500 [thread overview] Message-ID: <1513029335-5112-4-git-send-email-josef@toxicpanda.com> (raw) In-Reply-To: <1513029335-5112-1-git-send-email-josef@toxicpanda.com> From: Josef Bacik <jbacik@fb.com> This helper allows us to add an arbitrary amount to the fprop structures. Signed-off-by: Josef Bacik <jbacik@fb.com> --- include/linux/flex_proportions.h | 11 +++++++++-- lib/flex_proportions.c | 9 +++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h index 0d348e011a6e..9f88684bf0a0 100644 --- a/include/linux/flex_proportions.h +++ b/include/linux/flex_proportions.h @@ -83,8 +83,8 @@ struct fprop_local_percpu { 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, - int max_frac); +void __fprop_add_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl, + unsigned long nr, int max_frac); void fprop_fraction_percpu(struct fprop_global *p, struct fprop_local_percpu *pl, unsigned long *numerator, unsigned long *denominator); @@ -99,4 +99,11 @@ void fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl) local_irq_restore(flags); } +static inline +void __fprop_inc_percpu_max(struct fprop_global *p, + struct fprop_local_percpu *pl, int max_frac) +{ + __fprop_add_percpu_max(p, pl, 1, max_frac); +} + #endif diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index 2cc1f94e03a1..31003989d34a 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c @@ -255,8 +255,9 @@ void fprop_fraction_percpu(struct fprop_global *p, * Like __fprop_inc_percpu() except that event is counted only if the given * type has fraction smaller than @max_frac/FPROP_FRAC_BASE */ -void __fprop_inc_percpu_max(struct fprop_global *p, - struct fprop_local_percpu *pl, int max_frac) +void __fprop_add_percpu_max(struct fprop_global *p, + struct fprop_local_percpu *pl, unsigned long nr, + int max_frac) { if (unlikely(max_frac < FPROP_FRAC_BASE)) { unsigned long numerator, denominator; @@ -267,6 +268,6 @@ void __fprop_inc_percpu_max(struct fprop_global *p, return; } else fprop_reflect_period_percpu(p, pl); - percpu_counter_add_batch(&pl->events, 1, PROP_BATCH); - percpu_counter_add(&p->events, 1); + percpu_counter_add_batch(&pl->events, nr, PROP_BATCH); + percpu_counter_add(&p->events, nr); } -- 2.7.5 -- 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>
next prev parent reply other threads:[~2017-12-11 21:55 UTC|newest] Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-12-11 21:55 [PATCH v3 00/11] Metadata specific accouting and dirty writeout Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-11 21:55 ` [PATCH v3 01/10] remove mapping from balance_dirty_pages*() Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-11 21:55 ` [PATCH v3 02/10] writeback: convert WB_WRITTEN/WB_DIRITED counters to bytes Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-11 21:55 ` Josef Bacik [this message] 2017-12-11 21:55 ` [PATCH v3 03/10] lib: add a __fprop_add_percpu_max Josef Bacik 2017-12-19 7:25 ` Jan Kara 2017-12-11 21:55 ` [PATCH v3 04/10] writeback: convert the flexible prop stuff to bytes Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-11 21:55 ` [PATCH v3 05/10] writeback: add counters for metadata usage Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-19 7:52 ` Jan Kara 2017-12-11 21:55 ` [PATCH v3 06/10] writeback: introduce super_operations->write_metadata Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-11 23:36 ` Dave Chinner 2017-12-11 23:36 ` Dave Chinner 2017-12-12 18:05 ` Josef Bacik 2017-12-12 18:05 ` Josef Bacik 2017-12-12 22:20 ` Dave Chinner 2017-12-12 22:20 ` Dave Chinner 2017-12-12 23:59 ` Josef Bacik 2017-12-12 23:59 ` Josef Bacik 2017-12-19 12:07 ` Jan Kara 2017-12-19 21:35 ` Dave Chinner 2017-12-20 14:30 ` Jan Kara 2018-01-02 16:13 ` Josef Bacik 2018-01-02 16:13 ` Josef Bacik 2018-01-03 2:32 ` Dave Chinner 2018-01-03 2:32 ` Dave Chinner 2018-01-03 13:59 ` Jan Kara 2018-01-03 13:59 ` Jan Kara 2018-01-03 15:49 ` Josef Bacik 2018-01-03 15:49 ` Josef Bacik 2018-01-03 16:26 ` Jan Kara 2018-01-03 16:26 ` Jan Kara 2018-01-03 16:29 ` Josef Bacik 2018-01-03 16:29 ` Josef Bacik 2018-01-29 9:06 ` Chandan Rajendra 2018-01-29 9:06 ` Chandan Rajendra 2018-09-28 8:37 ` Chandan Rajendra 2018-01-04 1:32 ` Dave Chinner 2018-01-04 1:32 ` Dave Chinner 2018-01-04 9:10 ` Jan Kara 2018-01-04 9:10 ` Jan Kara 2017-12-19 12:21 ` Jan Kara 2017-12-11 21:55 ` [PATCH v3 07/10] export radix_tree_iter_tag_set Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-11 21:55 ` [PATCH v3 08/10] Btrfs: kill the btree_inode Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-11 21:55 ` [PATCH v3 09/10] btrfs: rework end io for extent buffer reads Josef Bacik 2017-12-11 21:55 ` Josef Bacik 2017-12-11 21:55 ` [PATCH v3 10/10] btrfs: add NR_METADATA_BYTES accounting Josef Bacik 2017-12-11 21:55 ` Josef Bacik
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=1513029335-5112-4-git-send-email-josef@toxicpanda.com \ --to=josef@toxicpanda.com \ --cc=akpm@linux-foundation.org \ --cc=hannes@cmpxchg.org \ --cc=jack@suse.cz \ --cc=jbacik@fb.com \ --cc=kernel-team@fb.com \ --cc=linux-btrfs@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-mm@kvack.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: linkBe 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.