From: Randy Dunlap <randy.dunlap@oracle.com>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] WorkStruct: Merge the pending bit into the wq_data pointer [try #2]
Date: Wed, 22 Nov 2006 08:32:23 -0800 [thread overview]
Message-ID: <20061122083223.6e0e5b76.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20061122130229.24778.13876.stgit@warthog.cambridge.redhat.com>
On Wed, 22 Nov 2006 13:02:29 +0000 David Howells wrote:
> Reclaim a word from the size of the work_struct by folding the pending bit and
> the wq_data pointer together. This shouldn't cause misalignment problems as
> all pointers should be at least 4-byte aligned.
>
> Signed-Off-By: David Howells <dhowells@redhat.com>
> ---
>
> drivers/block/floppy.c | 4 ++--
> include/linux/workqueue.h | 27 +++++++++++++++++++++++----
> kernel/workqueue.c | 41 ++++++++++++++++++++++++++++++++---------
> 3 files changed, 57 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
> index cef40b2..ecc017d 100644
> --- a/include/linux/workqueue.h
> +++ b/include/linux/workqueue.h
> @@ -14,11 +14,15 @@ struct workqueue_struct;
> typedef void (*work_func_t)(void *data);
>
> struct work_struct {
> - unsigned long pending;
> + /* the first word is the work queue pointer and the pending flag
> + * rolled into one */
> + unsigned long management;
> +#define WORK_STRUCT_PENDING 0 /* T if work item pending execution */
s/T/True/ # or whatever it means there
> +#define WORK_STRUCT_FLAG_MASK (3UL)
> +#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
> struct list_head entry;
> work_func_t func;
> void *data;
> - void *wq_data;
> };
>
> struct delayed_work {
> @@ -75,6 +79,21 @@ #define INIT_DELAYED_WORK(_work, _func,
> init_timer(&(_work)->timer); \
> } while (0)
>
> +/**
> + * work_pending - Find out whether a work item is currently pending
> + * @work: The work item in question
> + */
> +#define work_pending(work) \
> + test_bit(WORK_STRUCT_PENDING, &(work)->management)
> +
> +/**
> + * delayed_work_pending - Find out whether a delayable work item is currently
> + * pending
kernel-doc short function description needs to be on one line only.
If more description is needed, please put it after the parameter(s) list
and a "blank" ("*" only) line.
> + * @work: The work item in question
> + */
> +#define delayed_work_pending(work) \
> + test_bit(WORK_STRUCT_PENDING, &(work)->work.management)
> +
>
> extern struct workqueue_struct *__create_workqueue(const char *name,
> int singlethread);
---
~Randy
next prev parent reply other threads:[~2006-11-22 16:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 13:02 [PATCH 0/5] WorkStruct: Shrink work_struct by two thirds David Howells
2006-11-22 13:02 ` [PATCH 1/5] WorkStruct: Separate delayable and non-delayable events. [try #2] David Howells
2006-11-22 13:02 ` [PATCH 2/5] WorkStruct: Typedef the work function prototype " David Howells
2006-11-22 13:02 ` [PATCH 3/5] WorkStruct: Merge the pending bit into the wq_data pointer " David Howells
2006-11-22 16:32 ` Randy Dunlap [this message]
2006-11-22 13:02 ` [PATCH 4/5] WorkStruct: Pass the work_struct pointer instead of context data " David Howells
2006-11-22 15:02 ` [PATCH 0/5] WorkStruct: Shrink work_struct by two thirds David Howells
2006-11-22 21:20 ` Andrew Morton
2006-11-23 11:44 ` David Howells
2006-11-23 17:25 ` Linus Torvalds
2006-11-23 20:01 ` David Howells
2006-11-23 21:04 ` David Howells
2006-11-23 21:40 ` Andrew Morton
2006-11-23 14:59 ` David Howells
2006-11-23 16:01 ` Stefan Richter
2006-12-05 19:52 ` GIT pull on work_struct reduction tree David Howells
2006-12-05 20:16 ` Andrew Morton
2006-12-05 21:05 ` Stefan Richter
2006-12-05 21:41 ` David Howells
2006-12-06 15:06 ` David Howells
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=20061122083223.6e0e5b76.randy.dunlap@oracle.com \
--to=randy.dunlap@oracle.com \
--cc=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
all inboxes | Powered by JetHome®