From: Maneesh Soni <maneesh@in.ibm.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Chip Salzenberg <chip@pobox.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] 2.4.13pre3aa1: expand_fdset() may use invalid pointer
Date: Thu, 18 Oct 2001 15:18:28 +0530 [thread overview]
Message-ID: <20011018151828.M11266@in.ibm.com> (raw)
In-Reply-To: <20011017113245.A3849@perlsupport.com> <20011017204204.C2380@athlon.random> <20011018121124.L11266@in.ibm.com> <20011018102226.I12055@athlon.random>
In-Reply-To: <20011018102226.I12055@athlon.random>; from andrea@suse.de on Thu, Oct 18, 2001 at 10:22:26AM +0200
On Thu, Oct 18, 2001 at 10:22:26AM +0200, Andrea Arcangeli wrote:
> On Thu, Oct 18, 2001 at 12:11:24PM +0530, Maneesh Soni wrote:
> > +struct rcu_fd_array {
> > + struct rcu_head rh;
> > + struct file **array;
> > + int nfds;
> > +};
> > +
> > +struct rcu_fd_set {
> > + struct rcu_head rh;
> > + fd_set *openset;
> > + fd_set *execset;
> > + int nfds;
> > +};
>
> Some other very minor comment. I'd also rename them fd_array, and
> fd_set.
>
> think, when we add a spinlock to a data structure (say a semaphore or a
> waitqueue) to scale per-spinlock or per-waitqueue we're not going to
> rename the "struct semaphore" into "struct per_spinlock_semaphore", at
> least unless we also provide two different types of semaphores.
>
> same happens if we move a data structure into the slab cache, we don't
> call it "struct slab_semaphore" just because it gets allocated/freed via
> the slab cache rather than by using kmalloc/kfree.
Got it...but both fd_set and fd_array are not very straight forward as
other structures like struct dentry, so I didnot embedd rcu head in them
fd_set is defined as
typedef __kernel_fd_set fd_set;
where as __kernel_fd_set is as in (linux/posix_types.h)
typedef struct {
unsigned long fds_bits [__FDSET_LONGS];
} __kernel_fd_set;
so I don't think it is appropriate to add rcu_head and others (openset,
execset and nfds) in __kernel_fd_set. and thought rcu_fd_set could be
appropriate name. There is no "struct fd_array".
I think we can combine rcu_fd_set & rcu_fd_array like this
struct def_free_files_struct_args {
int nfds;
struct file **array;
fd_set *openset;
fd_set *execset;
struct rcu_head rh;
};
or just rename them as def_free_fdarray_args and def_free_fdset_args.
We also thought of embedding rcu head in the files_struct, but that was ruled
out as we are not freeing the entire files_struct but a couple of fields in
it. So it may happen that before the callback for one files_struct is processed
we queue another one for the same files_struct.
> I'd also put the rcu_head at the end of the structure, the rcu_head
> should be used only when we are going to free the data, so it's not used
> at runtime and it worth to keep the other fields in the first cacheline
> so they're less likely to be splitted off in more than one cacheline.
There is no problem in this one.
Regards,
Maneesh
--
Maneesh Soni
IBM Linux Technology Center,
IBM India Software Lab, Bangalore.
Phone: +91-80-5262355 Extn. 3999 email: maneesh@in.ibm.com
http://lse.sourceforge.net/locking/rcupdate.html
next prev parent reply other threads:[~2001-10-18 9:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-17 18:32 [PATCH] 2.4.13pre3aa1: expand_fdset() may use invalid pointer Chip Salzenberg
2001-10-17 18:42 ` Andrea Arcangeli
2001-10-18 6:41 ` Maneesh Soni
2001-10-18 8:22 ` Andrea Arcangeli
2001-10-18 9:48 ` Maneesh Soni [this message]
2001-10-18 10:06 ` Andrea Arcangeli
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=20011018151828.M11266@in.ibm.com \
--to=maneesh@in.ibm.com \
--cc=andrea@suse.de \
--cc=chip@pobox.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 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.