lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 29 Sep 2010 21:53:22 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Dave Chinner <david@...morbit.com>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 16/17] fs: Convert nr_inodes to a per-cpu counter

On Wed, 29 Sep 2010 22:18:48 +1000 Dave Chinner <david@...morbit.com> wrote:

> From: Eric Dumazet <dada1@...mosbay.com>
> 
> The number of inodes allocated does not need to be tied to the
> addition or removal of an inode to/from a list. If we are not tied
> to a list lock, we could update the counters when inodes are
> initialised or destroyed, but to do that we need to convert the
> counters to be per-cpu (i.e. independent of a lock). This means that
> we have the freedom to change the list/locking implementation
> without needing to care about the counters.
> 
>
> ...
>
> +int get_nr_inodes(void)
> +{
> +	int i;
> +	int sum = 0;
> +	for_each_possible_cpu(i)
> +		sum += per_cpu(nr_inodes, i);
> +	return sum < 0 ? 0 : sum;
> +}

This reimplements percpu_counter_sum_positive(), rather poorly

If one never intends to use the approximate percpu_counter_read() then
one could initialise the counter with a really large batch value, for a
very small performance gain.

> +int get_nr_inodes_unused(void)
> +{
> +	return inodes_stat.nr_unused;
> +}
>
> ...
>
> @@ -407,6 +407,8 @@ extern struct files_stat_struct files_stat;
>  extern int get_max_files(void);
>  extern int sysctl_nr_open;
>  extern struct inodes_stat_t inodes_stat;
> +extern int get_nr_inodes(void);
> +extern int get_nr_inodes_unused(void);

These are pretty cruddy names.  Unfotunately we don't really have a vfs
or "inode" subsystem name to prefix them with.

>
> ...
>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ