From: Dipankar Sarma <dipankar@in.ibm.com>
To: Frank van Maarseveen <frankvm@frankvm.com>
Cc: Pablo Fernandez <pablo.ferlop@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: max_fd
Date: Fri, 23 Sep 2005 22:56:53 +0530 [thread overview]
Message-ID: <20050923172653.GA4573@in.ibm.com> (raw)
In-Reply-To: <20050923170345.GA1555@janus>
On Fri, Sep 23, 2005 at 07:03:45PM +0200, Frank van Maarseveen wrote:
> On Fri, Sep 23, 2005 at 09:25:10PM +0530, Dipankar Sarma wrote:
> > On Fri, Sep 23, 2005 at 02:37:51PM +0200, Pablo Fernandez wrote:
> > Just do -
> >
> > struct fdtable *fdt;
> >
> > rcu_read_lock();
> > fdt = files_fdtable(files_struct);
> > if (fdt->max_fds......
> > ...
> > rcu_read_unlock();
>
> In include/linux/file.h I see this:
>
> #define files_fdtable(files) (rcu_dereference((files)->fdt))
>
> looks better to me unless you really want to update the
> struct fdtable.
I would much rather have it my way :)
Well, the main reason is that if that code is somehow copied
by to a lock-free critical section, it could cause problems.
If you dereference ->fdt multiple times in a lock-free
section, you could see two different pointers due to
a concurrent update.
I would advise sticking to the same convention everywhere.
Thanks
Dipankar
next prev parent reply other threads:[~2005-09-23 17:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-23 12:37 max_fd Pablo Fernandez
2005-09-23 15:55 ` max_fd Dipankar Sarma
2005-09-23 17:03 ` max_fd Frank van Maarseveen
2005-09-23 17:26 ` Dipankar Sarma [this message]
2005-09-23 18:40 ` max_fd Frank van Maarseveen
2005-09-23 18:46 ` max_fd Dipankar Sarma
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=20050923172653.GA4573@in.ibm.com \
--to=dipankar@in.ibm.com \
--cc=frankvm@frankvm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pablo.ferlop@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.