Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8320288rwb; Wed, 23 Nov 2022 19:59:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf6713LXTPbm2PSdQel1xDcDgaNlIUozWpulDZxNMclhjt5wLOunsdlwnlq+Ncmr+Uu6K0uC X-Received: by 2002:a17:902:b101:b0:187:31da:a274 with SMTP id q1-20020a170902b10100b0018731daa274mr11870016plr.103.1669262375978; Wed, 23 Nov 2022 19:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669262375; cv=none; d=google.com; s=arc-20160816; b=PQVBPg1rV5URqXv/Hd5ADNVK/BgAtcSzdM0O7lom5gQJMIwGm4Du4FSIejdzDuwdo7 CffIlQrEN71pjFkvmo8VxXLrDR/+8pye3Bd5YX8zH4AsPj50her36q/fcFA13YhQvHNh YpWR958G425FSBvp3mTQxP0apdyBCsH69Ly5puUkFsiEt+eIYnLJneNGI8WMP0I0aA4E pCOCuWmEHloMbr/lQx3nsMPHm4J1DuL/L/V98p+DU7WRDa8v1VVcD8cbHlJEoeBPY1Oq 4zoReYnYB1qpmz8aO3mljNis12hYGl2ElAwW9RhoR/jGsygZqT9dXQ0pNiM1BTVPjynW ebUw== 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=6BBzplv4usyuEIMVAm0qSmS4cJi8RTr3YYpBQBevHpg=; b=CXPexs2rwKbhspyApE7L+2szTI7zbxsC5wbTn/dTyc7NyFP0ky3IiG5yE5F0P1xPNa YKLiJPP6hBInFGPXU49e93ODSzxa8Wdb1+uAHARw9DxO+6fTMqunUJ/BfpaDBYcQQo+5 2ql7rLHwDjx9iPELK/Ztn3zIufctD/7LCpDuBPh/ZALmPVHzakpEJp9SeM9Zx984VRZA foZYsqzZGxSuKNoOwoDcfpg0pmSaBd5lazOcNb9HGujhIQiuXREnW/a5yeGFeithbWXG 6MDt2krHN1ORPL410Dju7ORY481zg6JqiYTit7SHMWiXOK+J1cqRVVLTKlR16R9xD+ep 16wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Cj7WMras; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a170902ec8a00b001769cc79508si21332379plg.291.2022.11.23.19.59.22; Wed, 23 Nov 2022 19:59:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Cj7WMras; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229598AbiKXDc4 (ORCPT + 88 others); Wed, 23 Nov 2022 22:32:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbiKXDcx (ORCPT ); Wed, 23 Nov 2022 22:32:53 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AA2C1C412 for ; Wed, 23 Nov 2022 19:32:51 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id k7so342756pll.6 for ; Wed, 23 Nov 2022 19:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=6BBzplv4usyuEIMVAm0qSmS4cJi8RTr3YYpBQBevHpg=; b=Cj7WMrasPvkvyAb/qeIh9ngQl6+RCuho//7eFZusoZVJ+Dg6U4nya27EHYYL9dHEOt wp3QavtAJPimFmg+vgztmtcV0c0QobHpI/wSh5hI6++bBO3RJwFp6wEXjjjBh+MaOGZa p41Qf5Kc/CgTRiL31j8YucyoUcuQminmXTDRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6BBzplv4usyuEIMVAm0qSmS4cJi8RTr3YYpBQBevHpg=; b=gLkAgmwUiwsRiKwcYu1vbIV+BdD+BabO6dg3npRj3qNOOS40yvzRv4B0L8YPbHewOI UgmgMKzs6tLdRAEaB6ymJovKpDxpFuXUnpqqHpZ3WuHklgdxjPAtB/n0D0eneX0T8pnS mJC1yRwmwMGELhWQBL2rzy0U1zcRjbY9O6FsrcYgQGPDxSFGd5rOZuoAbQ8A7grRwnwV PFur3sL9i0ly/uZ+QyAE+SF6ATKMUiA54UEnkfhKFUe6V2jPEDnKwHGlbFoaA6jdRIu/ 7PZL1UJLLAG3WlzK5cquPHqoDSd2uCsdklZ2FxixClwZkz9xxMy43ZBxD2UnA7EJkvJj rAnQ== X-Gm-Message-State: ANoB5pkXXXToY7ylHZxeDA+afAkots7vXexS38nu+0tz0QvU5+9KevCf AXXbueMkVD0DGbj2vSifqv8hdg== X-Received: by 2002:a17:903:264c:b0:186:6fde:e9f5 with SMTP id je12-20020a170903264c00b001866fdee9f5mr17083278plb.139.1669260770615; Wed, 23 Nov 2022 19:32:50 -0800 (PST) Received: from google.com ([240f:75:7537:3187:438d:8b02:662d:50b3]) by smtp.gmail.com with ESMTPSA id f11-20020a65550b000000b00460c67afbd5sm122401pgr.7.2022.11.23.19.32.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 19:32:50 -0800 (PST) Date: Thu, 24 Nov 2022 12:32:45 +0900 From: Sergey Senozhatsky To: Johannes Weiner , Nhat Pham Cc: Andrew Morton , Seth Jennings , Dan Streetman , Vitaly Wool , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH] zswap: do not allocate from atomic pool Message-ID: References: <20221122013338.3696079-1-senozhatsky@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (22/11/22 12:30), Sergey Senozhatsky wrote: > zswap_frontswap_load() should be called from preemptible > context (we even call mutex_lock() there) and it does not > look like we need to do GFP_ATOMIC allocaion for temp > buffer. The same applies to zswap_writeback_entry(). > > Use GFP_KERNEL for temporary buffer allocation in both > cases. > > Signed-off-by: Johannes Weiner > Signed-off-by: Nhat Pham > Signed-off-by: Sergey Senozhatsky > --- Folks, how do we want to proceed with this? One of the hunks here conflicts with https://lore.kernel.org/lkml/20221119001536.2086599-2-nphamcs@gmail.com/ Do we want to remove conflicting hunk from "[PATCH 1/6] zswap: fix writeback lock ordering for zsmalloc" and pick this patch up? > diff --git a/mm/zpool.c b/mm/zpool.c > index 68facc193496..f46c0d5e766c 100644 > --- a/mm/zpool.c > +++ b/mm/zpool.c > @@ -387,6 +387,13 @@ bool zpool_evictable(struct zpool *zpool) > * zpool_can_sleep_mapped - Test if zpool can sleep when do mapped. > * @zpool: The zpool to test > * > + * Some allocators enter non-preemptible context in ->map() callback (e.g. > + * disable pagefaults) and exit that context in ->unmap(), which limits what > + * we can do with the mapped object. For instance, we cannot wait for > + * asynchronous crypto API to decompress such an object or take mutexes > + * since those will call into the scheduler. This function tells us whether > + * we use such an allocator. > + * > * Returns: true if zpool can sleep; false otherwise. > */ > bool zpool_can_sleep_mapped(struct zpool *zpool) > diff --git a/mm/zswap.c b/mm/zswap.c > index 2d48fd59cc7a..3019f0bde194 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -958,7 +958,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle) > }; > > if (!zpool_can_sleep_mapped(pool)) { > - tmp = kmalloc(PAGE_SIZE, GFP_ATOMIC); > + tmp = kmalloc(PAGE_SIZE, GFP_KERNEL); > if (!tmp) > return -ENOMEM; > } > @@ -1311,7 +1311,7 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset, > } > > if (!zpool_can_sleep_mapped(entry->pool->zpool)) { > - tmp = kmalloc(entry->length, GFP_ATOMIC); > + tmp = kmalloc(entry->length, GFP_KERNEL); > if (!tmp) { > ret = -ENOMEM; > goto freeentry; > -- > 2.38.1.584.g0f3c55d4c2-goog >