Re: [RFC PATCH] mm, slab: Reduce space complexity of alien_cache using rbtree

From: Hyeonggon Yoo
Date: Mon Oct 04 2021 - 01:38:10 EST


On Sun, Oct 03, 2021 at 05:17:50AM +0000, Hyeonggon Yoo wrote:
> + for (i = 0; i < alc_ptr->capacity; i++) {
> + alc_ptr->pool[i] = kmalloc_node(sizeof(struct alien_object), gfp, node);
> + if (!alc_ptr->pool) {

There is mistake - the condition is (!alc_ptr->pool[i]).

> + for (i = i - 1; i >= 0; i--)
> + kfree(alc_ptr->pool[i]);
> + kfree(alc_ptr->pool);
> kfree(alc_ptr);
> return NULL;
> }
> }

Anyway, I want to hear other's opinions.
Is this trade-off sounds affordable to you?