All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Can I allocate memory dynamically when enqueue or dequeue? (adding some algorithms in kernel
@ 2002-10-20  7:02 jbonf
  2002-10-20  7:25 ` [LARTC] Can I allocate memory dynamically when enqueue or dequeue? (adding some algorithms in ke Werner Almesberger
  0 siblings, 1 reply; 2+ messages in thread
From: jbonf @ 2002-10-20  7:02 UTC (permalink / raw)
  To: lartc

    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 or just a suggest that do not use it
often? Thanks for your help.         bon

-----------------------------------------------------------------
< ¨C¤Ñ³£ Yahoo!©_¼¯ >  www.yahoo.com.tw
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [LARTC] Can I allocate memory dynamically when enqueue or dequeue? (adding some algorithms in ke
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Werner Almesberger @ 2002-10-20  7:25 UTC (permalink / raw)
  To: lartc

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-10-20  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [LARTC] Can I allocate memory dynamically when enqueue or dequeue? (adding some algorithms in ke Werner Almesberger

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.