Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2791240pxu; Sat, 19 Dec 2020 02:15:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgZQDFD2b4AyWXvujYq9Ae6rbE7SACB8zmrzcRamyIyxVomaCKuPo+o9fqCSNTt3p+X8CN X-Received: by 2002:a17:906:3404:: with SMTP id c4mr8026841ejb.86.1608372944220; Sat, 19 Dec 2020 02:15:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608372944; cv=none; d=google.com; s=arc-20160816; b=C6OqJ71F181Itv/rxMJ4969R1taYGXM0ZMRXOvbXkpipwg3mUinp3+3rUyHyaruQLo UtuDVoqYTyfnXUQxELG+NlzKUv12RdZhbaX0F5r6GbcJIhL26//1C/ZW3KGTN/A/hW8W ILS4bEuTZkIb0vuvh3tIY6ElYVy2mnuyU3JKR6sr4JTJVX2fB6YP9mOoFUVtJ7jd2ZCW r2XEt9KdI1roXNyTpC1lqyAh3yZSHg6lKr1oe0rM2S+qU9FLp9XfE3l5pJ5jP8M/108F V8c47QN+o5FPF6dOlrTDUinG1RAfcgYZAN8vTLES7ba5MGNzcNHe4QmSCRy+LFrINSfx UWcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=rA5u6Uncqt04IQOYCHSKZakA9uIdidKbJQodAUv/6Sc=; b=wkfH/FVtdNl45vsd9d7LvvkcZkEnQd0r64KdHu4H/lZNGBKsC3PNhVjVV/9tYg9o/t zcGF1vA8R5igcgJxCSXFN5nYeTdKNZ0Ag5tbHIq6laMxSbl1s/AouzltBsJV9Yty2fbL wfeBl7aMkRUrSMa9b+IEo9HsiVuuyev1UhRC7yywpxi0xxULz3ukIcl53CiOIv9UKF7W VEqyW75zqzl8PadzY+dpD3Nf3Yj5XnrlHFBdwsi1Vqu9HZfne5K6dDiGwXkCAXqkweQN Z5yFmAat0CfjmVe7m5kBRZ/KEgi6/biLI8CB8ENgMfqhmmagfDVKyuah/w3I8mJSzqfg uF9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=Sc9IcmgW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si8152030edy.201.2020.12.19.02.15.20; Sat, 19 Dec 2020 02:15:44 -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=@gmx.net header.s=badeba3b8450 header.b=Sc9IcmgW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726466AbgLSKN6 (ORCPT + 99 others); Sat, 19 Dec 2020 05:13:58 -0500 Received: from mout.gmx.net ([212.227.17.22]:49533 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726402AbgLSKN5 (ORCPT ); Sat, 19 Dec 2020 05:13:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1608372732; bh=6Lbh6Y5L+z/nVaTAt2yAOl/p4XTy7MmOdTh62bkdRLc=; h=X-UI-Sender-Class:Subject:From:To:Cc:Date:In-Reply-To:References; b=Sc9IcmgWNG3Qf5TTnemIQm4mhDpvQM73/R7EKSm+EDx0V04cC3zjh0c1X3aQLggja i7b9PMlpZ22C2b66uQgiSjYHhyLpDOMiXhyFh9vZq0Rfto/zEZGDEx6jgjS6SjnSgw Lrjw3ObINbflr1Ndm/vz8te5To/FitfiqKCWg5u8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from homer.fritz.box ([185.221.150.14]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MIdeX-1ktc0f37sT-00Ea16; Sat, 19 Dec 2020 11:12:12 +0100 Message-ID: Subject: Re: [patch] zswap: fix zswap_frontswap_load() vs zsmalloc::map/unmap() might_sleep() splat From: Mike Galbraith To: LKML Cc: linux-mm , Barry Song , Vitaly Wool , Sebastian Andrzej Siewior Date: Sat, 19 Dec 2020 11:12:10 +0100 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Idz0oKSM/QsVBcDqW56HRXUxdiKTtZgytnkZ1B7Fnhhx+zHUovd 8PQAE0NulElwTdORx9igmQW89VuEn4Nrff0gP7nfoyNEDyYAS8N9ySv1m1hJEOU1yVaaTEy 9YxFvwhL2BVVougcR8g/gdPnP39jQY8JFHwLRpgGJBliCodw1++Yc+SSr0rk1lmv0Ou1OZo apQhPdmrn8Wv8dIxzguHw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Ez/aHxnshM8=:SudlIm4DiRO9TB9rSPQd4J ij3HZyc6T7n+FIRt8vliuV5wwuCYkpDSl60D4iKb/5xF5Z3/Drek3r8A26re4iSD3nfbk2muc CFlNKCkDZmoTzxLeXjXvMhv6k31ErZu6UX2UGz/CkmLYLWkIs2hQP0JvlcN/1d7vIQXk7BIA6 2hEHpa/MCXp/kdgST58vVIVeOoc1p44SLJ7JGdQmeWChSaYLEGJG7ZrLsNN825pzr0ZiaYN+n NOWoNhlXKXFIlPSUPssfHAdNPJzpwBiBs4gvTzxDlDH5jxFVoYwG9RoW9Py+3ubDLKy6TPQoD xXov1pxjNk8gxKp0IWvHCzUG7VapmDY/YC0QEML3ni6qPXMJX+uMRQFp/nY9QD+CaaQdNLNLZ S/0ayu4luxFzC+yYIWRU+wGEEt/UGM8mriwRp12I/MawIzQf+ATnyy9wmlLH3lQ8z23ImCU6h 3F8rWvoCx7iyF/d49V2YKUw/vUhQfBdFLwNut9EILWh46lnzKXRcbIp53qar93NEi3QfIffm9 J9J8DlCPtn4INGh3PzoTAqlnnII/66Yrp+ij7x+Kx1z6bL7Mv4HcyUaG6yw8lo6A4WT6eifEU zjS64j9GjVUa9rF5Rv3hXvE3JwDbl9m8y7vdn4LBA18p/jTrwGpsu6tSrrrHmu+YhEV0t4sJH 1dKP6qxA5J0U16cwio0UnXpgzlgyLMhDdsAFoQxHHilAKjNAux/XmLL+XHo+3b2T6TuBAAjsp mGkiN0tmvHavujXR0FvamYrE3KNanvRguIdWCJK60Zyec+okuXYAaqN8wHTSTXNKVnedj8irY e9dC7SkaIQXhz3RJLgY6hynZjL18Di8YMsKktMx+72ZH3z7WhOt2T8qlZ2tmB1OETNT60KEvV dKBsK12WNf5e57spHTsQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (mailer partially munged formatting? resend) mm/zswap: fix zswap_frontswap_load() vs zsmalloc::map/unmap() might_sleep(= ) splat zsmalloc map/unmap methods use preemption disabling bit spinlocks. Take t= he mutex outside of pool map/unmap methods in zswap_frontswap_load() as is do= ne in zswap_frontswap_store(). Signed-off-by: Mike Galbraith Fixes: 1ec3b5fe6eec "mm/zswap: move to use crypto_acomp API for hardware a= cceleration" =2D-- mm/zswap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) =2D-- a/mm/zswap.c +++ b/mm/zswap.c @@ -1258,20 +1258,20 @@ static int zswap_frontswap_load(unsigned /* decompress */ dlen =3D PAGE_SIZE; + acomp_ctx =3D raw_cpu_ptr(entry->pool->acomp_ctx); + mutex_lock(acomp_ctx->mutex); src =3D zpool_map_handle(entry->pool->zpool, entry->handle, ZPOOL_MM_RO)= ; if (zpool_evictable(entry->pool->zpool)) src +=3D sizeof(struct zswap_header); - acomp_ctx =3D raw_cpu_ptr(entry->pool->acomp_ctx); - mutex_lock(acomp_ctx->mutex); sg_init_one(&input, src, entry->length); sg_init_table(&output, 1); sg_set_page(&output, page, PAGE_SIZE, 0); acomp_request_set_params(acomp_ctx->req, &input, &output, entry->length,= dlen); ret =3D crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_= ctx->wait); - mutex_unlock(acomp_ctx->mutex); zpool_unmap_handle(entry->pool->zpool, entry->handle); + mutex_unlock(acomp_ctx->mutex); BUG_ON(ret); freeentry: