From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97116C433DB for ; Thu, 14 Jan 2021 18:53:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 21B6623B1F for ; Thu, 14 Jan 2021 18:53:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21B6623B1F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 91B3B8D0109; Thu, 14 Jan 2021 13:53:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CBAB8D00F0; Thu, 14 Jan 2021 13:53:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 808E78D0109; Thu, 14 Jan 2021 13:53:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id 6B34C8D00F0 for ; Thu, 14 Jan 2021 13:53:26 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 258E0180AE7E2 for ; Thu, 14 Jan 2021 18:53:26 +0000 (UTC) X-FDA: 77705278812.28.copy61_0b033b327529 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 014036C06 for ; Thu, 14 Jan 2021 18:53:25 +0000 (UTC) X-HE-Tag: copy61_0b033b327529 X-Filterd-Recvd-Size: 5115 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Thu, 14 Jan 2021 18:53:25 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id o19so9553072lfo.1 for ; Thu, 14 Jan 2021 10:53:25 -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=8id0QsOoCd1Wapd/6ws1sOdKxK2wM46IqsWsKLfo5fI=; b=p1OTanxpCTgYjl9vGfe6uN+oVsdVxCvDNMdHFsvtLvEOnQ8xOJkuuRmaFzLLUvJF01 jgVpF/+4fSj9ZiDLiBZj3Mtf2PYRkjJ/Zo6Rj2R4meqZrsUcCidU/HOuwFqV4CGgF8qk ViDg0HuZZcp2b9EbcawQwzJveqlv0EH/WI0tw= 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=8id0QsOoCd1Wapd/6ws1sOdKxK2wM46IqsWsKLfo5fI=; b=M6VW5w8RWx1OWW3tQ4stxDOzUeGGtfcNpAcS5od8T+lpPmu0nh9YxLq2rTWgYgahnQ 4X5gCgSOoJLFZtaq3O3vWGExx+UeKwsDuHat5qiezLB6vF/FOlXCE7HZ9C9rw4jqFH73 RVtWkJSV2bye/hJs51v9mM2k7YcHCFuvKhrBcT+Sz5pF0lSiwA5FjzSgFJGJhDnLhCKU SEJ3qVlIcEx1uam9CT8WQ505j9FQmmh6bjgUIzoTGUbAclMAgMScwJYunNltBMwum3Ty b8DhiXaBlsdPX1TpN1eUJwyrgsxRo9jd6N3+G0D5b6MyQnaRCMv1fKHrWrAWfJS/dUub BEkA== X-Gm-Message-State: AOAM5302omQJ7I6YE1ZpL+tFPJGloDedOWct1FSiwaWGvO/RU9OmI6cO hSVgts0kjwDyIpTrHoZRTHsw95Im5VRDJqXgqfgbhA== X-Google-Smtp-Source: ABdhPJwxutt5mBGLHhXMuzHouJT8hE2Hs4XEhihPuDQZ3yAe7Jk7oz8ZpNWbdTVxvv+vCz3U2xZatFKsIKh0gUvfid8= X-Received: by 2002:a19:8c8:: with SMTP id 191mr3763633lfi.492.1610650404069; Thu, 14 Jan 2021 10:53:24 -0800 (PST) MIME-Version: 1.0 References: <1608894171-54174-1-git-send-email-tiantao6@hisilicon.com> <1608894171-54174-2-git-send-email-tiantao6@hisilicon.com> In-Reply-To: From: Vitaly Wool Date: Thu, 14 Jan 2021 19:53:13 +0100 Message-ID: Subject: Re: [RFC mm/zswap 1/2] mm/zswap: add the flag can_sleep_mapped To: Shakeel Butt Cc: Minchan Kim , Tian Tao , Seth Jennings , Dan Streetman , Andrew Morton , Barry Song , Linux MM , Sergey Senozhatsky Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jan 14, 2021 at 7:43 PM Shakeel Butt wrote: > > On Thu, Jan 14, 2021 at 10:29 AM Minchan Kim wrote: > > > > On Fri, Dec 25, 2020 at 07:02:50PM +0800, Tian Tao wrote: > > > add a flag to zpool, named is "can_sleep_mapped", and have it set true > > > for zbud/z3fold, set false for zsmalloc. Then zswap could go the current > > > path if the flag is true; and if it's false, copy data from src to a > > > temporary buffer, then unmap the handle, take the mutex, process the > > > buffer instead of src to avoid sleeping function called from atomic > > > context. > > > > > > Signed-off-by: Tian Tao > > > --- > > > include/linux/zpool.h | 3 +++ > > > mm/zpool.c | 13 +++++++++++++ > > > mm/zswap.c | 50 +++++++++++++++++++++++++++++++++++++++++++++----- > > > 3 files changed, 61 insertions(+), 5 deletions(-) > > > > > > diff --git a/include/linux/zpool.h b/include/linux/zpool.h > > > index 51bf430..e899701 100644 > > > --- a/include/linux/zpool.h > > > +++ b/include/linux/zpool.h > > > @@ -73,6 +73,7 @@ u64 zpool_get_total_size(struct zpool *pool); > > > * @malloc: allocate mem from a pool. > > > * @free: free mem from a pool. > > > * @shrink: shrink the pool. > > > + * @sleep_mapped: whether zpool driver can sleep during map. > > > > I don't think it's a good idea. It just breaks zpool abstraction > > in that it exposes internal implementation to user to avoid issue > > zswap recently introduced. It also conflicts zpool_map_handle's > > semantic. > > > > Rather than introducing another break in zpool due to the new > > zswap feature recenlty introduced, zswap could introduce > > CONFIG_ZSWAP_HW_COMPRESSOR. Once it's configured, zsmalloc could > > be disabled. And with disabling CONFIG_ZSWAP_HW_COMPRESSOR, zswap > > doesn't need to make any bounce buffer copy so that no existing > > zsmalloc user will see performance regression. > > > > I agree with Minchan. There is no reason to add extra overhead for > configurations where there is no hardware available. I still don't get what the suggested alternative is. How would disabling CONFIG_ZSWAP_HW_COMPRESSOR help if zswap is using acomp API? Best regards, Vitaly