From: Andrew Morton <akpm@osdl.org>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/4] WorkStruct: Shrink work_struct by two thirds
Date: Mon, 20 Nov 2006 11:17:12 -0800 [thread overview]
Message-ID: <20061120111712.5e399d12.akpm@osdl.org> (raw)
In-Reply-To: <20061120142713.12685.97188.stgit@warthog.cambridge.redhat.com>
On Mon, 20 Nov 2006 14:27:13 +0000
David Howells <dhowells@redhat.com> wrote:
> The workqueue struct is huge, and this limits it's usefulness. On a 64-bit
> architecture it's nearly 100 bytes in size, of which the timer_list is half.
> These patches shrink work_struct by 8 of the 12 words it ordinarily consumes.
> This is done by:
>
> (1) Splitting the timer out so that delayable work items are defined by a
> separate structure which incorporates a basic work_struct and a timer.
>
> (2) Folding the pending bit and wq_data data together
>
> (3) Removing the private data. This can almost always be derived from the
> address of the work_struct using container_of() and the selection of the
> work function. For the cases where the container of the work_struct may
> go away the moment the pending bit is cleared, it is made possible to
> defer the release of the structure by deferring the clearing of the
> pending bit.
>
>
> These patches reduce the size of the work_struct thusly:
>
> #WORDS 32-bit arch 64-bit arch
> =============== =============== ===============
> As is 12 48 bytes 96 bytes
> Non-delayable 4 16 bytes 32 bytes
> Delayable 10 40 bytes 80 bytes
>
> I've looked through most of the usages of work_structs, and I think that
> probably fewer than half the work_structs used actually require delayability,
> and I'm not sure that it's absolutely necessary in all cases.
via this:
> --- a/include/linux/workqueue.h
> +++ b/include/linux/workqueue.h
> @@ -17,6 +17,10 @@ struct work_struct {
> void (*func)(void *);
> void *data;
> void *wq_data;
> +};
> +
> +struct dwork_struct {
> + struct work_struct work;
> struct timer_list timer;
> };
>
Could we reduce the migration pain by leaving the work_struct as-is and
defining a new, leaner one and then incrementally migrating stuff over to
it?
struct work_struct_lite {
unsigned long pending;
struct list_head entry;
void (*func)(void *);
void *data;
void *wq_data;
};
struct work_struct {
struct work_struct_lite w;
struct timer_list timer;
}
or even
struct work_struct {
union {
struct work_struct_lite w;
struct {
unsigned long pending;
struct list_head entry;
void (*func)(void *);
void *data;
void *wq_data;
};
}
struct timer_list timer;
};
next prev parent reply other threads:[~2006-11-20 19:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-20 14:27 [PATCH 0/4] WorkStruct: Shrink work_struct by two thirds David Howells
2006-11-20 14:27 ` [PATCH 1/4] WorkStruct: Separate delayable and non-delayable events David Howells
2006-11-20 15:35 ` Stefan Richter
2006-11-20 15:43 ` David Howells
2006-11-20 18:32 ` Linus Torvalds
2006-11-21 11:30 ` David Howells
2006-11-20 14:27 ` [PATCH 2/4] WorkStruct: Typedef the work function prototype David Howells
2006-11-20 15:38 ` Stefan Richter
2006-11-20 15:47 ` David Howells
2006-11-20 16:13 ` Stefan Richter
2006-11-21 14:53 ` Jan Engelhardt
2006-11-20 14:27 ` [PATCH 3/4] WorkStruct: Merge the pending bit into the wq_data pointer David Howells
2006-11-21 0:34 ` Randy Dunlap
2006-11-20 14:27 ` [PATCH 4/4] WorkStruct: Pass the work_struct pointer instead of context data David Howells
2006-11-20 16:32 ` [PATCH 0/4] WorkStruct: Shrink work_struct by two thirds Trond Myklebust
2006-11-21 10:06 ` Christoph Hellwig
2006-11-21 11:08 ` David Howells
2006-11-20 19:17 ` Andrew Morton [this message]
2006-11-21 11:28 ` David Howells
2006-11-21 13:09 ` Jan Engelhardt
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=20061120111712.5e399d12.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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