mirror of
https://github.com/versity/scoutfs.git
synced 2026-06-07 20:22:35 +00:00
scoutfs: use larger percpu_counter batch
The percpu_counter library merges the per-cpu counters with a shared count when the per-cpu counter gets larger than a certain value. The default is very small, so we often end up taking a shared lock to update the count. Use a larger batch so that we take the lock less often. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -201,11 +201,21 @@ struct scoutfs_counters {
|
||||
pcpu <= &SCOUTFS_SB(sb)->counters->LAST_COUNTER; \
|
||||
pcpu++)
|
||||
|
||||
#define scoutfs_inc_counter(sb, which) \
|
||||
percpu_counter_inc(&SCOUTFS_SB(sb)->counters->which)
|
||||
/*
|
||||
* We always read with _sum, we have no use for the shared count and
|
||||
* certainly don't want to pay the cost of a shared lock to update it.
|
||||
* The default batch of 32 make counter increments show up significantly
|
||||
* in profiles.
|
||||
*/
|
||||
#define SCOUTFS_PCPU_COUNTER_BATCH (1 << 30)
|
||||
|
||||
#define scoutfs_add_counter(sb, which, cnt) \
|
||||
percpu_counter_add(&SCOUTFS_SB(sb)->counters->which, cnt)
|
||||
#define scoutfs_inc_counter(sb, which) \
|
||||
__percpu_counter_add(&SCOUTFS_SB(sb)->counters->which, 1, \
|
||||
SCOUTFS_PCPU_COUNTER_BATCH)
|
||||
|
||||
#define scoutfs_add_counter(sb, which, cnt) \
|
||||
__percpu_counter_add(&SCOUTFS_SB(sb)->counters->which, cnt, \
|
||||
SCOUTFS_PCPU_COUNTER_BATCH)
|
||||
|
||||
void __init scoutfs_init_counters(void);
|
||||
int scoutfs_setup_counters(struct super_block *sb);
|
||||
|
||||
Reference in New Issue
Block a user