LWN.net Logo

Getting the measure of ksize()

Getting the measure of ksize()

Posted Feb 19, 2009 20:54 UTC (Thu) by oak (guest, #2786)
Parent article: Getting the measure of ksize()

Couldn't krealloc() just use ksize() internally to speed up its operation?

IPSec performance would then just depend on this particular implementation
detail...


(Log in to post comments)

Getting the measure of ksize()

Posted Feb 21, 2009 10:40 UTC (Sat) by mjcoder (guest, #54432) [Link]

That's exactly what I thought too...

krealloc()

Posted Feb 21, 2009 14:26 UTC (Sat) by corbet (editor, #1) [Link]

I think krealloc() does use ksize(). That's part of why it exists.

I don't know for sure, but my guess is that the networking folks don't like that approach because it requires copying the packet in the case where the needed room doesn't exist. Networking hackers hate copying packets. They would rather just allocated the extra space elsewhere if need be.

krealloc()

Posted Feb 28, 2009 7:00 UTC (Sat) by Russ.Dill@gmail.com (subscriber, #52805) [Link]

A quick check of mm/util.c confirms this. Initially I had no idea what the network developers are thinking. If the new size will fit in the original allocation, then no locks will be taken, no sleeping, etc.

But then it occured to me that the code that needs to do the expansion may be holding locks and may be in interrupt context. Preparing to call krealloc may require releasing locks, etc, since it could take locks.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds