All of lore.kernel.org
 help / color / mirror / Atom feed
From: Werner Almesberger <wa@almesberger.net>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Can I allocate memory dynamically when enqueue or dequeue? (adding some algorithms in ke
Date: Sun, 20 Oct 2002 07:25:00 +0000	[thread overview]
Message-ID: <marc-lartc-103510023329479@msgid-missing> (raw)
In-Reply-To: <marc-lartc-103509740728498@msgid-missing>

jbonf wrote:
>     Hi, I'm adding a queuing disc. inside kernel. I am
> confused that it seems few other qdiscs allocate
> memory dynamically. Is it invalid to use memory calls
> like molloc

No, you can kmalloc(...,GPF_ATOMIC) in enqueue and dequeue
functions.

> or just a suggest that do not use it often?

As a general rule, enqueue and dequeue are performance-critical,
so if you can move processing elsewhere, that's better. (E.g. if
you just need to allocate some scratch space, you might as well
do this at qdisc init time - calls to enqueue, dequeue, and
requeue are serialized through dev->queue_lock.)

Of course, kmalloc and kfree are reasonably fast, so if you
really need to use them, that's no tragedy. I'd be more worried
about the times it takes to do whatever you're going to do with
that kmalloc'ed space ...

For more details on locking in traffic control and such, you may
want to read tc.ps in
ftp://icaftp.epfl.ch/pub/people/almesber/junk/tc-04FEB2001-0.tar.gz
it's a bit old and also unfinished, but it should give you an
idea of how things are organized.

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina         wa@almesberger.net /
/_http://www.almesberger.net/____________________________________________/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

      reply	other threads:[~2002-10-20  7:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-20  7:02 [LARTC] Can I allocate memory dynamically when enqueue or dequeue? (adding some algorithms in kernel jbonf
2002-10-20  7:25 ` Werner Almesberger [this message]

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=marc-lartc-103510023329479@msgid-missing \
    --to=wa@almesberger.net \
    --cc=lartc@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.