netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: weiyang@linux.vnet.ibm.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] net core: optimize netdev_create_hash()
Date: Fri, 15 Mar 2013 17:39:30 -0400 (EDT)	[thread overview]
Message-ID: <20130315.173930.609483181280202005.davem@davemloft.net> (raw)
In-Reply-To: <1363365131-7906-1-git-send-email-weiyang@linux.vnet.ibm.com>

From: Wei Yang <weiyang@linux.vnet.ibm.com>
Date: Sat, 16 Mar 2013 00:32:11 +0800

> netdev_create_hash() is divded into two steps:
> 1. allocate space for hash_head
> 2. initialize hash_head->first to NULL for each hash_head
> 
> This patch merge the two steps into one step.
> 
> When allocating the space for hash_head, it will use kzalloc() instead of
> kmalloc(). Then hash_head->first is set to NULL during the allocation step,
> which means it is not necessary to call INIT_HLIST_HEAD() for each hash_head.
> 
> This will:
> 1. reduce the code size
> 2. reduce the run time of iteration on initializing hash_head array

Please do not ever post changes like this.

This makes assumtions about the list head implementation that
we should not make.  If someone adds a debugging facility that
causes lists to be initialized differently, it will be broken
for this hash table now.

The reason the abstractions exist is so that people do not
do things like you are trying to do.

If you want to add an interface in the generic list facilities which
performs this simplifcation, fine.  Implement it and post such a
suggestion to linux-kernel, and then once such a facility is present
in Linus's tree we can start using it in the networkng code.

  reply	other threads:[~2013-03-15 21:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15 16:32 [PATCH] net core: optimize netdev_create_hash() Wei Yang
2013-03-15 21:39 ` David Miller [this message]
     [not found]   ` <20130316000051.GA5941@richard.(null)>
2013-03-16  1:19     ` Wei Yang

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=20130315.173930.609483181280202005.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=weiyang@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).