public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC, PATCH] avoid some atomics in open()/close() for monothreaded processes
Date: Wed, 22 Mar 2006 07:59:11 +0100	[thread overview]
Message-ID: <4420F5BF.7030701@cosmosbay.com> (raw)
In-Reply-To: <20060321224140.7e40a380.akpm@osdl.org>

Andrew Morton a écrit :
> Eric Dumazet <dada1@cosmosbay.com> wrote:
>> Goal : Avoid some locking/unlocking 'struct files_struct'->file_lock for mono 
>> threaded processes.
>>
>> We define files_multithreaded() function .
>>
>> static inline int files_multithreaded(const struct files_struct *files)
>> {
>>         return sizeof(files->file_lock) > 0 && atomic_read(&files->count) > 1;
>> }
> 
> That's bascially sizeof(spinlock_t).  That's architecture dependent and
> varies wildly according to the day of week.

I used sizeof(files->file_lock) instead of sizeof(spinlock_t) because I found 
it more explicit , while not using ugly ifdefs.

> 
> It _might_ work in all situations - probably you checked that.  But I still
> wouldn't do it because it might break in the future.  Let's be explicit and
> stick the appropriate ifdefs in there.
> 
> I'd also consider renaming it to files_shared() - processes are
> multithreaded, not data structures.

Thanks for the feedback, I will redo the patch and test it on various 
platforms before resubmit (including performance data :) )

> 
> Once you're done with that we should change fget_light() and fput_light() to
> use this helper.  Separate patch.

Hum... this discussion is not relevant with fget_light() unless I mistaken.

Nowadays, this function doesnt take spinlock thanks to RCU

Eric

  reply	other threads:[~2006-03-22  6:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-12  2:04 More than 8 CPUs detected and CONFIG_X86_PC cannot handle it on 2.6.16-rc6 Krzysztof Oledzki
2006-03-12  5:03 ` Andrew Morton
2006-03-12 11:04   ` Krzysztof Oledzki
2006-03-12 11:25     ` Andrew Morton
2006-03-12 13:05       ` Krzysztof Oledzki
2006-03-12 15:35         ` Venkatesh Pallipadi
2006-03-12 21:13           ` Krzysztof Oledzki
2006-03-12 22:30             ` Andrew Morton
2006-03-13 19:36               ` Ashok Raj
2006-03-13 19:51                 ` Andrew Morton
2006-03-13 20:05                   ` Ashok Raj
2006-03-13 22:22                     ` Andrew Morton
2006-03-13 23:04                       ` Ashok Raj
2006-03-15  5:44                         ` Nathan Lynch
2006-03-15  6:18                           ` Shaohua Li
2006-03-15  7:31                             ` Andrew Morton
2006-03-15  9:37                               ` [PATCH] No need to protect current->group_info in sys_getgroups(), in_group_p() and in_egroup_p() Eric Dumazet
2006-03-20 19:09                                 ` [PATCH] Use unsigned int types for a faster bsearch Eric Dumazet
2006-03-22  5:06                                   ` [PATCH] Use __read_mostly on some hot fs variables Eric Dumazet
2006-03-22  5:15                                     ` Nick Piggin
2006-03-22  6:23                                     ` [RFC, PATCH] avoid some atomics in open()/close() for monothreaded processes Eric Dumazet
2006-03-22  6:41                                       ` Andrew Morton
2006-03-22  6:59                                         ` Eric Dumazet [this message]
2006-03-22  7:03                                           ` Andrew Morton
2006-03-15 18:09                               ` More than 8 CPUs detected and CONFIG_X86_PC cannot handle it on 2.6.16-rc6 Ashok Raj

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=4420F5BF.7030701@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=akpm@osdl.org \
    --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