Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2794897pxu; Sat, 19 Dec 2020 02:23:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN11sTB20BK7jCFW2gzj8RQVP/dswL+cZuOLlOC3rFeJ4CYLiiMXzAdK/EeUSZkSfU2KoP X-Received: by 2002:a17:906:c310:: with SMTP id s16mr7924060ejz.186.1608373399703; Sat, 19 Dec 2020 02:23:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608373399; cv=none; d=google.com; s=arc-20160816; b=J2eED65FcLjkCCRldFp54Ac95Xcme7Dht8ZIcWuQMESDiE2voed39H0tKtUO5TG2t+ TxA5ZdU+M8poB0+yR2RGtQIWPlztziZVj0ZP/dNxYMmu8SsChoo9i3Q0P1s5D5Do+SXg 4aTxxEXXlNe8DC7Zy2Ugt9y7X/bPx7fouj+chdHPS7Hi9OTp8xR/EoE/bMjiRlda5da7 maTifDF+bOQxBP5OVknJ1Whb8uRapGaVxXZ2JtJyZYHUnr8dA2LaP7IDaVR/jdStIkif vj88oD0rgaJ2l0bMek6TxHoPLQzU82v2H9sbPinTcIAaI+NTEa89D7tET2IGAKtOHxhp V1iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0KuMNpEWRPz2T71g8hiLTxxkoiK9tvmHyh46ViDzZU4=; b=LcBIXcRgA3AC3aeQhtMETkfxkJbgkX7/eCOnQ24LGIDPMhw9Bj4X6Ih6/V/VsxP011 8xGwcu0bPJGGGetBCnIziznOZTI1XhrwOIesJDZkGWygj/lvSsuU/RNDO7brc4FUybY+ GsNDBHzT0mFGU82MxC/d4kUwUm1z/jh/oUJI1R2P4M87YGkQ9EJ8pxW8HWtbG9Nz6wet JrsdaVeCgYxHHDGOvoOX0TZVQ7GPMChQUGSjR7+z28aRfjPxlsmqli9JUa0xcpkMC78S mmsZgwdDflfJV65LGL4d9Y6bNR3wL3djEy9o8F3zrmb/EllInyESr6WuEDuRKdrgnaJr g7nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@konsulko.com header.s=google header.b=tdwnV2QU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr9si5844751ejc.729.2020.12.19.02.22.56; Sat, 19 Dec 2020 02:23:19 -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=@konsulko.com header.s=google header.b=tdwnV2QU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726540AbgLSKVW (ORCPT + 99 others); Sat, 19 Dec 2020 05:21:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726457AbgLSKVW (ORCPT ); Sat, 19 Dec 2020 05:21:22 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9806AC0617B0 for ; Sat, 19 Dec 2020 02:20:41 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id y19so11859936lfa.13 for ; Sat, 19 Dec 2020 02:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0KuMNpEWRPz2T71g8hiLTxxkoiK9tvmHyh46ViDzZU4=; b=tdwnV2QUnapSUPLlbQ2+uohghX+wGoEaVxuEh7qeg/6XNoRfCe/HWZtWZp6qXKL+rZ H29h5u2iN0L+1gXvix/aN7d2fr7v/UdVAmTH5pCBj7g0BgMoDqwXhJvvlGxMDWtN4HGn 0Z43YzSDxyXqWwdhmMQkFkwpz86Bmo2kkBiTk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0KuMNpEWRPz2T71g8hiLTxxkoiK9tvmHyh46ViDzZU4=; b=IgYN6TFKq9y5CQabAqi0PZnmZYVxakB6YC2GJzMcYF9I4KkO+a+4qn9bN3IsArl/8q eEMolW3Ra6aQOEHUKKs8TR2jExEsvfLA82VU3cYy/bj442v7o/c0b4xvjFnQ/KFvrQga l3dW66dejHlx2ktq9w3zAayRT8a0hzL5bGbhF0keb8BEvrZIWjhadohT7yScq28Bqym1 era9OuZncF36VPIHmkG1Fs35L2EZi2URcvEARQU0xVX6QemNs/0dD7xgglNWcq9+WdjN L8cLNzdbE7GrPn8VY8tNK8wmTnf53JlAUVR5/Qw3MQ7eKvWy79QHdqvc9teZ8aVyJYwz +xgg== X-Gm-Message-State: AOAM531JCARJfitMQbAZuxYfu2/as6mAbprDerOnu1l48dLEPkvNZHmT MuAcwMS1EJca4vdBz3YnJ/FQ0EAncplL4CtdgX6snw== X-Received: by 2002:a05:6512:54b:: with SMTP id h11mr3211671lfl.407.1608373240114; Sat, 19 Dec 2020 02:20:40 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Vitaly Wool Date: Sat, 19 Dec 2020 11:20:29 +0100 Message-ID: Subject: Re: [patch] zswap: fix zswap_frontswap_load() vs zsmalloc::map/unmap() might_sleep() splat To: Mike Galbraith Cc: LKML , linux-mm , Barry Song , Sebastian Andrzej Siewior Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mike, On Sat, Dec 19, 2020 at 11:12 AM Mike Galbraith wrote: > > (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 the > mutex outside of pool map/unmap methods in zswap_frontswap_load() as is done > in zswap_frontswap_store(). oh wait... So is zsmalloc taking a spin lock in its map callback and releasing it only in unmap? In this case, I would rather keep zswap as is, mark zsmalloc as RT unsafe and have zsmalloc maintainer fix it. Best regards, Vitaly > Signed-off-by: Mike Galbraith > Fixes: 1ec3b5fe6eec "mm/zswap: move to use crypto_acomp API for hardware acceleration" > --- > mm/zswap.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -1258,20 +1258,20 @@ static int zswap_frontswap_load(unsigned > > /* decompress */ > dlen = PAGE_SIZE; > + acomp_ctx = raw_cpu_ptr(entry->pool->acomp_ctx); > + mutex_lock(acomp_ctx->mutex); > src = zpool_map_handle(entry->pool->zpool, entry->handle, ZPOOL_MM_RO); > if (zpool_evictable(entry->pool->zpool)) > src += sizeof(struct zswap_header); > > - acomp_ctx = 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 = 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: >