[Click] [PATCH] More number of elements configuration support.
Eddie Kohler
kohler at cs.ucla.edu
Tue Sep 11 11:38:18 EDT 2007
Applied, thanks!
(Hooray, first patch applied directly from email!)
Eddie
Joonwoo Park wrote:
> Hi,
>
> For the second time after patch for click_qsort().
> Recently I tried to configure about 4000 click elements. (Lots of
> interfaces from VLAN)
> But I couldn't get it due to size limitation of atomic memory
> allocation of ClickIno::grow().
> After configuration, 'ls -al /click/' shows nothing.
> I think we need vmalloc() or kmalloc(GFP_KERNEL) at there.
> I tried vmalloc() with CLICK_LALLOC()
> Therefore, It showed me up to running 7500 elements. (for further more
> I got a failed Vector::reserve())
> I hope I didn't missed something that we can't use vmalloc instead of
> kmalloc(GFP_ATOMIC) at that point.
>
> -
> Signed-off-by: Joonwoo Park <joonwpark81 at gmail.com>
>
> lib/ino.cc | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/ino.cc b/lib/ino.cc
> index 7491bcb..b7f7c34 100644
> --- a/lib/ino.cc
> +++ b/lib/ino.cc
> @@ -39,7 +39,7 @@ ClickIno::cleanup()
> {
> for (int i = 0; i < _cap; i++)
> _x[i].name.~String();
> - delete[] ((uint8_t *)_x);
> + CLICK_LFREE(_x, sizeof(Entry) * _cap);
> initialize();
> }
>
> @@ -52,13 +52,13 @@ ClickIno::grow(int min_size)
> while (new_cap < min_size)
> new_cap *= 2;
> // cheat on memory: bad me!
> - Entry *nse = (Entry *)(new uint8_t[sizeof(Entry) * new_cap]);
> + Entry *nse = (Entry *)CLICK_LALLOC(sizeof(Entry) * new_cap);
> if (!nse)
> return -ENOMEM;
> memcpy(nse, _x, sizeof(Entry) * _cap);
> for (int i = _cap; i < new_cap; i++)
> new((void *)&nse[i]) String();
> - delete[] ((uint8_t *)_x);
> + CLICK_LFREE(_x, sizeof(Entry) * _cap);
> _x = nse;
> _cap = new_cap;
> return 0;
> -
>
> Joonwoo Park (Jason Park)
More information about the click
mailing list