public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Remove completion from struct klist_node
Date: Thu, 2 Oct 2008 15:17:45 -0700	[thread overview]
Message-ID: <20081002221745.GC10485@kroah.com> (raw)
In-Reply-To: <20081002214308.GP13822@parisc-linux.org>

On Thu, Oct 02, 2008 at 03:43:08PM -0600, Matthew Wilcox wrote:
> 
> Removing the completion from klist_node reduces its size from 64 bytes
> to 28 on x86-64.  To maintain the semantics of klist_remove(), we add
> a single list of klist nodes which are pending deletion and scan them.
> 
> Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
> 
>  include/linux/klist.h |    2 --
>  lib/klist.c           |   48 ++++++++++++++++++++++++++++++++++++++++++++----
>  2 files changed, 44 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/klist.h b/include/linux/klist.h
> index 06c338e..989a335 100644
> --- a/include/linux/klist.h
> +++ b/include/linux/klist.h
> @@ -13,7 +13,6 @@
>  #define _LINUX_KLIST_H
>  
>  #include <linux/spinlock.h>
> -#include <linux/completion.h>
>  #include <linux/kref.h>
>  #include <linux/list.h>
>  
> @@ -41,7 +40,6 @@ struct klist_node {
>  	struct klist		*n_klist;
>  	struct list_head	n_node;
>  	struct kref		n_ref;
> -	struct completion	n_removed;
>  };
>  
>  extern void klist_add_tail(struct klist_node *n, struct klist *k);
> diff --git a/lib/klist.c b/lib/klist.c
> index cca37f9..2b609ee 100644
> --- a/lib/klist.c
> +++ b/lib/klist.c
> @@ -36,7 +36,7 @@
>  
>  #include <linux/klist.h>
>  #include <linux/module.h>
> -
> +#include <linux/sched.h>
>  
>  /**
>   * klist_init - Initialize a klist structure.
> @@ -77,7 +77,6 @@ static void add_tail(struct klist *k, struct klist_node *n)
>  static void klist_node_init(struct klist *k, struct klist_node *n)
>  {
>  	INIT_LIST_HEAD(&n->n_node);
> -	init_completion(&n->n_removed);
>  	kref_init(&n->n_ref);
>  	n->n_klist = k;
>  	if (k->get)
> @@ -140,12 +139,36 @@ void klist_add_before(struct klist_node *n, struct klist_node *pos)
>  }
>  EXPORT_SYMBOL_GPL(klist_add_before);
>  
> +struct klist_waiter {
> +	struct klist_waiter *next;
> +	struct klist_node *node;
> +	struct task_struct *process;
> +	int woken;
> +};

Why not use the built-in list.h functions here?

Other than that, looks good, thanks.

greg k-h

  reply	other threads:[~2008-10-02 22:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02 21:43 [PATCH] Remove completion from struct klist_node Matthew Wilcox
2008-10-02 22:17 ` Greg KH [this message]
2008-10-03 14:06   ` Matthew Wilcox
2008-10-03 20:41     ` Greg KH
2008-10-16 20:57       ` Matthew Wilcox

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=20081002221745.GC10485@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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