Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3536263pxu; Mon, 30 Nov 2020 05:23:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVxmgxzXCfNU09/LwJzi00EqGnDEvJAoBJJjbHP9Lp54CnQ2QPSXcshkllmj2NPz1IhBr7 X-Received: by 2002:a17:906:4c82:: with SMTP id q2mr20027375eju.285.1606742629306; Mon, 30 Nov 2020 05:23:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606742629; cv=none; d=google.com; s=arc-20160816; b=bdrCL1e5JMgS+fBY9QJzfRMNUHFxyt9KWo/8bcsFzosgGcX4S4hujT7awEnpIEZST4 CtPQGlnuQMhTtRn9ESnppFhsKzrM7wb9RUvSoOc36LxysXyq28/zEiXT885fY4MVOGDZ A68NrWz5CzpIiCotL3IVCO1sec23+/iRzy9fZFC/tJR4FdKnm/Na3jr8PIsmROZ395f/ J6ej24BJf/7gIHUheYZj10zA56UMd65vg89IumKRNpWmC0AfU3EC9tmEvcuT5crKsVM/ Q3dW8rwkzXaZatM3XJpXRS235N1aSiCCp28q2RYiBr3Wzaki5Is2b631CXQgj8eCZ5U4 1OPQ== 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:dkim-signature :dkim-signature:date; bh=uFMc1nju8Vt+w/vefCY3bj1WY0IJrNxSDeMxCywROQg=; b=bY20I5lrIvXHEPnjKj1j6Z2ASlPhDIyrUOO1X3o3iy9RabX5QNUOAXAejh3+c4+wKU PI1YCY6C3dewtIT6ETfSU6N1I3i4XQncHrXLff9FEvPqQa0zlGizZCw5z0BtnBVguJ3k N7gTuVIg5oUh2T3mh34TfkbI/WwhHhStFUGs/B4ETfUUjQ/pBa+nHGGEoFfMgJtjbS1c DxH5QUf8s/NHyEslJWrbH6P93xtPiegpmOlN8pWtba9432l2Hdf9CP9BTRn086TcKrWm rUdrxzOtbEw5WWmGyxAkKzMWO9jX712WKO5Bm+GCNJPeAXj2OJ0zkHvNpKOBNNNREf2b U45w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1uWmTfu4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yk13si10410180ejb.414.2020.11.30.05.23.26; Mon, 30 Nov 2020 05:23:49 -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=@linutronix.de header.s=2020 header.b=1uWmTfu4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726467AbgK3NU7 (ORCPT + 99 others); Mon, 30 Nov 2020 08:20:59 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:48632 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbgK3NU6 (ORCPT ); Mon, 30 Nov 2020 08:20:58 -0500 Date: Mon, 30 Nov 2020 14:20:14 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1606742416; 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=uFMc1nju8Vt+w/vefCY3bj1WY0IJrNxSDeMxCywROQg=; b=1uWmTfu4E+nW1ShlsxD9EkPl+HtTbSBaXRGNfYqW2y9EyghV7JUsbVjNZF15dUXCEttzV1 pfOPiYaDf1CEwvcv+kqAmYmfcFrF287JLC+YT7XxeIXlku5VmpZTJNaFdtoDdtp0ir43Vb +U1zk6nHHmUjIL1Xkjg+WxxxgPhApKGAsa9dkDQGPvXraCQd9dcv3N7EQLE1tXKIdK9aZB e6CT95tMIJr4ZkD2F/eeOFPTg9rCTRJsSRopfXKVrUhnm9aa8IHxc8Q/8l6DG0zdc7Rpel 0t65oJm9U6bwr4XfAHjlKrpeDe/ukeCZiFxw/5XyMM/4TdzblbAqKR0Wd3QPGQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1606742416; 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=uFMc1nju8Vt+w/vefCY3bj1WY0IJrNxSDeMxCywROQg=; b=VEiRQK1ouW5vtsrgyZZddGP84TQY04+uKfrJtsrO3P/CUbab6habOZQ14lnCtRu6k8CY+f B41PZuPoziCLTWBQ== From: Sebastian Andrzej Siewior To: Mike Galbraith Cc: Oleksandr Natalenko , 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: <20201130132014.mlvxeyiub3fpwyw7@linutronix.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <90c4857c53b657147bfb71a281ece9839b0373c2.camel@gmx.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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