mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] removes filp_count_lock and changes nr_files type to atomic_t
Date: Thu, 25 Aug 2005 11:05:44 +0200	[thread overview]
Message-ID: <1124960744.3222.11.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <430D8518.8020502@cosmosbay.com>

On Thu, 2005-08-25 at 10:45 +0200, Eric Dumazet wrote:
> This patch removes filp_count_lock spinlock, used to protect files_stat.nr_files.
> 
> Just use atomic_t type and atomic_inc()/atomic_dec() operations.
> 
> This patch assumes that atomic_read() is a plain {return v->counter;} on all 
> architectures. (keywords : sysctl, /proc/sys/fs/file-nr, proc_dointvec)
> 

this patch adds atomic ops where there were none before
>  static inline void file_free(struct file *f)
> @@ -70,7 +62,7 @@
>  	/*
>  	 * Privileged users can go above max_files
>  	 */
> -	if (files_stat.nr_files >= files_stat.max_files &&
> +	if (atomic_read(&files_stat.nr_files) >= files_stat.max_files &&
>  				!capable(CAP_SYS_ADMIN))
>  		goto over;
>  

here 

> @@ -94,10 +86,10 @@
>  
>  over:
>  	/* Ran out of filps - report that */
> -	if (files_stat.nr_files > old_max) {
> +	if (atomic_read(&files_stat.nr_files) > old_max) {
>  		printk(KERN_INFO "VFS: file-max limit %d reached\n",
>  					files_stat.max_files);
> -		old_max = files_stat.nr_files;
> +		old_max = atomic_read(&files_stat.nr_files);
>  	}
>  	goto fail;

and here

for those architectures that need atomics for read (parisc? arm?)

however.. wouldn't it be better to make this a per cpu variable for
write, and for read iterate or do something smart otherwise?



  reply	other threads:[~2005-08-25  9:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-24 21:46 [patch] Additions to .data.read_mostly section Ravikiran G Thirumalai
2005-08-24 22:38 ` Eric Dumazet
2005-08-25  7:56 ` Arjan van de Ven
2005-08-25  8:45   ` [PATCH] removes filp_count_lock and changes nr_files type to atomic_t Eric Dumazet
2005-08-25  9:05     ` Arjan van de Ven [this message]
2005-08-25  9:20       ` Eric Dumazet
2005-08-25  9:31         ` Arjan van de Ven
2005-08-25  9:08     ` Christoph Hellwig
2005-08-25  9:17       ` Eric Dumazet
2005-08-25  9:23         ` Christoph Hellwig
2005-08-25 10:41           ` Eric Dumazet
2005-08-25 11:11             ` Nick Piggin
2005-08-25 12:26               ` Eric Dumazet
2005-08-25 14:51                 ` Nick Piggin
2005-08-25 14:56                   ` Christoph Hellwig
2005-08-25 15:13                   ` Eric Dumazet
2005-08-25 18:19                     ` Dipankar Sarma
2005-08-25 18:36                       ` Christoph Hellwig
2005-08-26  1:16                     ` Nick Piggin

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=1124960744.3222.11.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=akpm@osdl.org \
    --cc=dada1@cosmosbay.com \
    --cc=linux-kernel@vger.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®