On Mar 17, 4:34 am, "[email protected]" <[email protected]> wrote: > Hello, > > I had a look at slab allocation, and saw two strange things: > > The first one concern the special value for chunk minimal size when > chunk_factor is 2: > /* Factor of 2.0 means use the default memcached behavior */ > if (factor == 2.0 && size < 128) > size = 128; > > I think I understand the purpose of this one: having a chunk size > aligned on power of 2. But why am I forced to do so ? As I can tune > chunk_size with -n option, why having -f 2 -n x with x being less than > 72 (128 - sizeof(item)) isn't authorized ? > > The other point is that slab classes stop at POWER_BLOCK / 2: > while (++i < POWER_LARGEST && size <= POWER_BLOCK / 2) { > > It means some slab classes are missing whereas they may be useful. > Imagine I have the default settings. Classes grow with factor 1.25 > until class 38 (478568 bytes) and then class 39 is 1MB. So each time I > store an item of size around half a MB, it uses a 1 MB chunk. Is it on > purpose, or is it some code that remains from time where chunk factor > was not tunable ?
That change (c9607c6d) seems to have happened around the same time the power-of-two stuff was dropped. It's not a very clean change, so it's kind of hard to tell the intent: 9 files changed, 1078 insertions(+), 356 deletions(-) It's go a one-line description that basically describes it as a branch merge. Either too much stuff happened in this one sitting or subversion ate the details. Hopefully someone involved in that can speak up, but in the meantime, have you done any testing without this change?
