[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openconnect-devel
Subject:    [PATCH] Initial work on automatically reallocated buffer size for CSD script
From:       dwmw2 () infradead ! org (David Woodhouse)
Date:       2010-02-22 14:09:52
Message-ID: 1266847792.1820.13840.camel () macbook ! infradead ! org
[Download RAW message or body]

On Fri, 2010-02-12 at 23:03 +0100, Adam Pi?tyszek wrote:
> 
> The relevant patches are in my repository:
> http://git.infradead.org/users/ediap/openconnect-csd2.git

Thanks. The last commit there isn't strictly needed -- we weren't
actually allocating the +1 byte repeatedly and losing space. It went
like this...

 done = 0
 (re)allocate 'done' + 16385 == 16385
 read 16KiB, set 'done' to 16KiB.
 reallocate 'done' + 16385 == 32769
 read another 16KiB, set 'done' to 32KiB
 reallocate 'done' + 16385 == 49153

So we only ever had the one extra byte, not one extra byte for each time
round the loop.

But doing it your way is probably slightly more efficient since it's
only allocating an even number of pages most of the time, not extending
one byte into a final page on every allocation.

I've pushed this to the main repository now; thanks.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic