All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ian McDonald" <ian.mcdonald@jandi.co.nz>
To: dccp@vger.kernel.org
Subject: Re: [PATCH 8/43]: New RX History Step 2 - Initialisation and cleanup
Date: Fri, 06 Apr 2007 03:32:00 +0000	[thread overview]
Message-ID: <5640c7e00704052032n17d841f8vc1fd55ee6fda7b48@mail.gmail.com> (raw)
In-Reply-To: <200704051633.46816@strip-the-willow>

On 4/6/07, Gerrit Renker <gerrit@erg.abdn.ac.uk> wrote:
> [CCID 3]: New RX History Step 2 - Initialisation and cleanup
> +int tfrc_rx_hist_init(struct tfrc_rx_hist *h)
> +{
> +       int i;
> +
> +       for (i = 0; i <= NDUPACK; i++) {
> +               h->ring[i] = kmem_cache_alloc(tfrcxh->dccprxh_slab, GFP_ATOMIC);
> +               if (h->ring[i] = NULL)
> +                       return 1;
> +       }
> +       spin_lock_init(&h->lock);
> +       h->loss_count = 0;
> +       h->loss_start = 0;
> +       return 0;
> +}
> +
> +EXPORT_SYMBOL_GPL(tfrc_rx_hist_init);

Given that you are allocating a fixed size amount of memory which is
known at compile time I think that allocating one block per entry is
the wrong approach and you lose half the value of having it in a ring
buffer as you still have to dereference. This uses more memory to
store each of the pointers and there is a good chance that they may
not be contiguous in memory and thus your cache memory gets more
dirty.

When I started working on the code to remove linked list I was looking
at creating an array of 8 all in one operation when going to be first
used. I also share Eddies comment about the size of this.

NB I'm not saying that this shouldn't go in. I'm just saying this is
not the most efficient.

Ian
-- 
Web: http://wand.net.nz/~iam4/
Blog: http://iansblog.jandi.co.nz
WAND Network Research Group

  reply	other threads:[~2007-04-06  3:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05 15:33 [PATCH 8/43]: New RX History Step 2 - Initialisation and cleanup Gerrit Renker
2007-04-06  3:32 ` Ian McDonald [this message]
2007-04-06  8:48 ` Gerrit Renker
2007-04-07  4:25 ` Ian McDonald
2007-04-09 12:13 ` Gerrit Renker

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=5640c7e00704052032n17d841f8vc1fd55ee6fda7b48@mail.gmail.com \
    --to=ian.mcdonald@jandi.co.nz \
    --cc=dccp@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.