Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3563425pxu; Mon, 30 Nov 2020 05:57:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoNh0ksuCj71IUvwjtJQ88r7jxsdX1NHQbUmYzmAE50l2E2FQbqDh01NVDp++n8bvhC//p X-Received: by 2002:aa7:da01:: with SMTP id r1mr22051072eds.45.1606744674802; Mon, 30 Nov 2020 05:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606744674; cv=none; d=google.com; s=arc-20160816; b=tY4Ixs6LL7BATQi203PQhcwRROy0lB2CxzGGiCkCDu7IWw6HaY6WiKohASjPB9PMf/ QeDARUzJhbV5k7KUumHGcqYPXEcAYVAyiWLTjOEXzAF3RSOYWJLk3mZFq14Y4R4bKKqu IteJ+hXbQPPhfXUm9zTVNN0ajtP6c4qidqC7cJSR/QcyzgYc47i/vrElTseq2z4aztfS xmcKvL3Y2nKt2DnzhYU4vS9hCovmqyo25Lhs+0j7iWWLpAgSj4pKe8mnnKFt8d8ky8vm kaT2TwF3Ok3U/u+ADVoo7xx5W94nKJcG/tI2u3EW48x3XLKNCSQuDZriqhQkUCpZ4X3i 9qZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RFHLyr5yJAiwqzy/tg+7SSSk7uhDHJnuCus8X6tDJDk=; b=frB/WtArVg9qsc/ybC4HuoV5CPUZePIiCCELduX5M5hYCGcZHTtaMUGic9kqRJ0bFw pzfV3oPeWlck/572g0o0X1mPH/ItMGumIpOkmrIB0fL1YuhRcOQNjnCfmdVXmDbAeaI5 dml3u1H0wYZFmBTC5tJikpsOJ0CjinkKq+q29S5488DKI/66KjGOE/9EPfjDexpBtVxL O+6HoPwnBojCbFWRm0FZZigjQfH/n9aVtDWfbzzGYI7Gjfn99A8MNKeMfiKrpOV3CjGT E3tTmI2xORJCZEqykDjbYza1+iUjjRKhoixa+J4Zz3v1ved5Uu1KMUktK+nY6BnpH42D MP+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=WzuoZvpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v17si1956441edy.0.2020.11.30.05.57.31; Mon, 30 Nov 2020 05:57:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=WzuoZvpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726962AbgK3NyG (ORCPT + 99 others); Mon, 30 Nov 2020 08:54:06 -0500 Received: from vulcan.natalenko.name ([104.207.131.136]:51164 "EHLO vulcan.natalenko.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726908AbgK3NyF (ORCPT ); Mon, 30 Nov 2020 08:54:05 -0500 Received: from localhost (home.natalenko.name [151.237.229.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vulcan.natalenko.name (Postfix) with ESMTPSA id 4EC7A8B59BC; Mon, 30 Nov 2020 14:53:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=natalenko.name; s=dkim-20170712; t=1606744403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RFHLyr5yJAiwqzy/tg+7SSSk7uhDHJnuCus8X6tDJDk=; b=WzuoZvpu9O2FW5dvtqmJS12nQrxdcjNn4H3cQywMebYlWoYOBOcV92J4LxbZcNc29X1++1 dAeIR4aNOo5FQ4NAoUnm9Rbi/SX4YyJty1OfHRhVYWA1v13h38IgUpEo832g87UUj0u3s2 EGPn4+fc0z98TQuFWymKt0hgCJaX17M= Date: Mon, 30 Nov 2020 14:53:22 +0100 From: Oleksandr Natalenko To: Sebastian Andrzej Siewior Cc: Mike Galbraith , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Steven Rostedt , Thomas Gleixner , linux-rt-users@vger.kernel.org Subject: Re: scheduling while atomic in z3fold Message-ID: <20201130135322.zi7moa57ajbdvfpy@spock.localdomain> References: <20201128140523.ovmqon5fjetvpby4@spock.localdomain> <20201128140924.iyqr2h52z2olt6zb@spock.localdomain> <20201128142723.zik6d5skvt3uwu5f@spock.localdomain> <15171df044b167351e7f6a688aabd71bade9ae2a.camel@gmx.de> <79ee43026efe5aaa560953ea8fe29a826ac4e855.camel@gmx.de> <20201129112922.db53kmtpu76xxukj@spock.localdomain> <90c4857c53b657147bfb71a281ece9839b0373c2.camel@gmx.de> <20201130132014.mlvxeyiub3fpwyw7@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201130132014.mlvxeyiub3fpwyw7@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 30, 2020 at 02:20:14PM +0100, Sebastian Andrzej Siewior wrote: > 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), Is it a residue? > +}; > > static int zswap_dstmem_prepare(unsigned int cpu) > { > > > -Mike > > Sebastian -- Oleksandr Natalenko (post-factum)