On 2020-11-29 12:41:14 [+0100], Mike Galbraith wrote: > On Sun, 2020-11-29 at 12:29 +0100, Oleksandr Natalenko wrote: > > > > Ummm so do compressors explode under non-rt kernel in your tests as > > well, or it is just -rt that triggers this? > > I only tested a non-rt kernel with z3fold, which worked just fine. I tried this and it did not not explode yet. Mike, can you please confirm? diff --git a/mm/z3fold.c b/mm/z3fold.c index 18feaa0bc5377..0bf70f624a4bd 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -642,14 +642,17 @@ static inline void add_to_unbuddied(struct z3fold_pool *pool, { if (zhdr->first_chunks == 0 || zhdr->last_chunks == 0 || zhdr->middle_chunks == 0) { - struct list_head *unbuddied = get_cpu_ptr(pool->unbuddied); - + struct list_head *unbuddied; int freechunks = num_free_chunks(zhdr); + + migrate_disable(); + unbuddied = this_cpu_ptr(pool->unbuddied); + spin_lock(&pool->lock); list_add(&zhdr->buddy, &unbuddied[freechunks]); spin_unlock(&pool->lock); zhdr->cpu = smp_processor_id(); - put_cpu_ptr(pool->unbuddied); + migrate_enable(); } } @@ -887,7 +890,8 @@ static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool, lookup: /* First, try to find an unbuddied z3fold page. */ - unbuddied = get_cpu_ptr(pool->unbuddied); + migrate_disable(); + unbuddied = this_cpu_ptr(pool->unbuddied); for_each_unbuddied_list(i, chunks) { struct list_head *l = &unbuddied[i]; @@ -905,7 +909,7 @@ static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool, !z3fold_page_trylock(zhdr)) { spin_unlock(&pool->lock); zhdr = NULL; - put_cpu_ptr(pool->unbuddied); + migrate_enable(); if (can_sleep) cond_resched(); goto lookup; @@ -919,7 +923,7 @@ static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool, test_bit(PAGE_CLAIMED, &page->private)) { z3fold_page_unlock(zhdr); zhdr = NULL; - put_cpu_ptr(pool->unbuddied); + migrate_enable(); if (can_sleep) cond_resched(); goto lookup; @@ -934,7 +938,7 @@ static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool, kref_get(&zhdr->refcount); break; } - put_cpu_ptr(pool->unbuddied); + migrate_enable(); if (!zhdr) { int cpu; diff --git a/mm/zswap.c b/mm/zswap.c index 78a20f7b00f2c..b24f761b9241c 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -394,7 +394,9 @@ struct zswap_comp { u8 *dstmem; }; -static DEFINE_PER_CPU(struct zswap_comp, zswap_comp); +static DEFINE_PER_CPU(struct zswap_comp, zswap_comp) = { + .lock = INIT_LOCAL_LOCK(lock), +}; static int zswap_dstmem_prepare(unsigned int cpu) { > -Mike Sebastian