From: Andrew Morton <akpm@osdl.org>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Shrinks sizeof(files_struct) and better layout
Date: Wed, 4 Jan 2006 03:45:34 -0800 [thread overview]
Message-ID: <20060104034534.45d9c18a.akpm@osdl.org> (raw)
In-Reply-To: <43BB1178.7020409@cosmosbay.com>
Eric Dumazet <dada1@cosmosbay.com> wrote:
>
> [PATCH] shrink the fdset and reorder fields to give better multi-threaded
> performance.
Boy, this is going to need some elaborate performance testing..
We can't have that `8 * sizeof(embedded_fd_set)' splattered all over the
tree. This?
fs/file.c | 6 +++---
include/linux/file.h | 5 +++++
include/linux/init_task.h | 2 +-
kernel/fork.c | 2 +-
4 files changed, 10 insertions(+), 5 deletions(-)
diff -puN fs/file.c~shrinks-sizeoffiles_struct-and-better-layout-tidy fs/file.c
--- devel/fs/file.c~shrinks-sizeoffiles_struct-and-better-layout-tidy 2006-01-04 03:45:10.000000000 -0800
+++ devel-akpm/fs/file.c 2006-01-04 03:45:10.000000000 -0800
@@ -125,7 +125,7 @@ static void free_fdtable_rcu(struct rcu_
kmem_cache_free(files_cachep, fdt->free_files);
return;
}
- if (fdt->max_fdset <= 8 * sizeof(embedded_fd_set) &&
+ if (fdt->max_fdset <= EMBEDDED_FD_SET_SIZE &&
fdt->max_fds <= NR_OPEN_DEFAULT) {
/*
* The fdtable was embedded
@@ -157,7 +157,7 @@ static void free_fdtable_rcu(struct rcu_
void free_fdtable(struct fdtable *fdt)
{
if (fdt->free_files ||
- fdt->max_fdset > 8 * sizeof(embedded_fd_set) ||
+ fdt->max_fdset > EMBEDDED_FD_SET_SIZE ||
fdt->max_fds > NR_OPEN_DEFAULT)
call_rcu(&fdt->rcu, free_fdtable_rcu);
}
@@ -221,7 +221,7 @@ fd_set * alloc_fdset(int num)
void free_fdset(fd_set *array, int num)
{
- if (num <= 8 * sizeof(embedded_fd_set)) /* Don't free an embedded fdset */
+ if (num <= EMBEDDED_FD_SET_SIZE) /* Don't free an embedded fdset */
return;
else if (num <= 8 * PAGE_SIZE)
kfree(array);
diff -puN include/linux/file.h~shrinks-sizeoffiles_struct-and-better-layout-tidy include/linux/file.h
--- devel/include/linux/file.h~shrinks-sizeoffiles_struct-and-better-layout-tidy 2006-01-04 03:45:10.000000000 -0800
+++ devel-akpm/include/linux/file.h 2006-01-04 03:45:10.000000000 -0800
@@ -25,6 +25,11 @@ typedef struct {
unsigned long fds_bits[1];
} embedded_fd_set;
+/*
+ * More than this number of fds: we use a separately allocated fd_set
+ */
+#define EMBEDDED_FD_SET_SIZE (8 * sizeof(struct embedded_fd_set))
+
struct fdtable {
unsigned int max_fds;
int max_fdset;
diff -puN include/linux/init_task.h~shrinks-sizeoffiles_struct-and-better-layout-tidy include/linux/init_task.h
--- devel/include/linux/init_task.h~shrinks-sizeoffiles_struct-and-better-layout-tidy 2006-01-04 03:45:10.000000000 -0800
+++ devel-akpm/include/linux/init_task.h 2006-01-04 03:45:10.000000000 -0800
@@ -7,7 +7,7 @@
#define INIT_FDTABLE \
{ \
.max_fds = NR_OPEN_DEFAULT, \
- .max_fdset = 8 * sizeof(embedded_fd_set), \
+ .max_fdset = EMBEDDED_FD_SET_SIZE, \
.fd = &init_files.fd_array[0], \
.close_on_exec = (fd_set *)&init_files.close_on_exec_init, \
.open_fds = (fd_set *)&init_files.open_fds_init, \
diff -puN kernel/fork.c~shrinks-sizeoffiles_struct-and-better-layout-tidy kernel/fork.c
--- devel/kernel/fork.c~shrinks-sizeoffiles_struct-and-better-layout-tidy 2006-01-04 03:45:10.000000000 -0800
+++ devel-akpm/kernel/fork.c 2006-01-04 03:45:10.000000000 -0800
@@ -584,7 +584,7 @@ static struct files_struct *alloc_files(
newf->next_fd = 0;
fdt = &newf->fdtab;
fdt->max_fds = NR_OPEN_DEFAULT;
- fdt->max_fdset = 8 * sizeof(embedded_fd_set);
+ fdt->max_fdset = EMBEDDED_FD_SET_SIZE;
fdt->close_on_exec = (fd_set *)&newf->close_on_exec_init;
fdt->open_fds = (fd_set *)&newf->open_fds_init;
fdt->fd = &newf->fd_array[0];
_
next prev parent reply other threads:[~2006-01-04 11:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20051108185349.6e86cec3.akpm@osdl.org>
[not found] ` <437226B1.4040901@cosmosbay.com>
[not found] ` <20051109220742.067c5f3a.akpm@osdl.org>
[not found] ` <4373698F.9010608@cosmosbay.com>
2006-01-04 0:06 ` Eric Dumazet
2006-01-04 9:11 ` Jan Engelhardt
2006-01-04 10:12 ` Eric Dumazet
2006-01-04 10:28 ` Folkert van Heusden
2006-01-04 10:45 ` Andi Kleen
2006-01-04 11:13 ` Eric Dumazet
2006-01-04 11:15 ` Andi Kleen
2006-01-04 11:19 ` Eric Dumazet
2006-01-04 11:22 ` Andi Kleen
2006-01-04 11:41 ` Eric Dumazet
2006-01-04 11:58 ` Andi Kleen
2006-01-06 3:01 ` David Lang
2006-01-06 6:35 ` Eric Dumazet
2006-01-06 7:26 ` David Lang
2006-01-06 7:37 ` Eric Dumazet
2006-01-06 8:28 ` David Lang
2006-01-04 11:45 ` Andrew Morton [this message]
2006-01-04 13:14 ` Eric Dumazet
2006-01-04 23:24 ` [2.6 patch] Define BITS_PER_BYTE Adrian Bunk
2006-01-05 7:03 ` Jan Engelhardt
2006-01-05 15:18 ` Bryan O'Sullivan
2006-01-05 19:19 ` H. Peter Anvin
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=20060104034534.45d9c18a.akpm@osdl.org \
--to=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®