Re: [PATCH 03/19] fs: Convert nr_inodes and nr_unused to per-cpucounters

From: Eric Dumazet
Date: Sat Oct 16 2010 - 06:34:17 EST


Le samedi 16 octobre 2010 Ã 21:04 +1100, Dave Chinner a Ãcrit :

> get_nr_inodes_unused() is called on every single shrinker call. i.e.
> for every 128 inodes we attempt to reclaim. Given that I'm seeing
> inode reclaim rate in the order of a million per second on a 8p box,
> that meets your criteria for using the generic percpu counter
> infrastructure.
>
> Also, get_nr_inodes() is also called by get_nr_dirty_inodes(), which is
> called by the high level inode writeback code, so will typically be
> called in the order of tens of times per second, and the number of
> calls increased depending on the number of filesystems that are
> active. It's still much higher frequency than your "cat
> /proc/sys/fs/inode-nr" example indicates it might be called.
>
> So I'd say that by your reasoning, the choice of using the generic
> percpu counters is the right one to make.

You missed one thing :

In cases you mention, you want a precise count (aka
percpu_counter_sum_positive()), not the approximate one (aka
percpu_counter_read_positive()).

The only difference is then the possible/online cpu loop difference.

I am saying :

No need to maintain an approximate counter if we dont _read_ it, ever.

Andrew answer : Eric, cant you implement this generically ?



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/