Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5202307rwb; Mon, 21 Nov 2022 18:34:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ybgge8EPXSBUr2dVBEvzKUzXmSQUMzgsDXfE5nOa5Jc4b3a2e1F1XlxG+PnyMgxDCMxqQ X-Received: by 2002:a05:6402:5299:b0:461:7291:79c1 with SMTP id en25-20020a056402529900b00461729179c1mr9421449edb.68.1669084494611; Mon, 21 Nov 2022 18:34:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669084494; cv=none; d=google.com; s=arc-20160816; b=fEOeqVpu0e1OJaQw2vDmGXKcK5o6N7rkpkJTqyRpnk9Jv5gVx0RQJlaRdPh7oS+rZe Udt75XXKN4m4c0TdxGYhqgUpML6i/Bggnrrmdw9eBl5s0joEInORl0prrYNnN1hgy34H UufbtCCsS0oJ5zFIpekKFVUPHkzJGeLZJmK87UZw6Y20KfmbBDBrOITutGlMrQ977CvI FbOC7/gP9izJKGNd+b8K7f7qQb4qpzqcmIYmER/N3+gkRy4INbc7um0K509kcCPZMUDN CbBhs5NZKZjptK/n4Dn0fW5fyxAkQthN/Of84ZxZ5XVrAQJr/7vcPg2TEtvx8rpT0tim qY+w== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=t4j3SlCdBkp3/8RFyXNasQREu1l57bvs2+dRI/rRbps=; b=upNaRjfQsTSqY3v6Sl+7xEBSn+L3bK0H5HwlQdQ+eaS5GE8mLsibZJtId/gV4DsX/d z73m6izehy02hjGkfMvPzhoFffav2X0TiyxrzxxzIgZu8bKOnByk5KxYtA/b2U4A9m0N gvi1KCjTmvgOShIK+3pZaqzSb9O6dcPuNty6oebwqNjL1cO+xQWdwI6aNo4BFLEcjGeV B0x/xkRGpBqgVdu/3TWVA0okzxBosszZFcKgR3dScIuX10RXFqt52hfR8Bz5T7QB+kRR x1X5O66dsJQDqZV4zalIwDip7FsdlWnPunsrLCTgABV8TyLd/WkSH0Dh2RYCEJw7Rfiv DwzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=suWLKTl+; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i34-20020a0564020f2200b0045d5ba4c3cesi10776580eda.47.2022.11.21.18.34.32; Mon, 21 Nov 2022 18:34:54 -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=@linux-foundation.org header.s=korg header.b=suWLKTl+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231640AbiKVB4X (ORCPT + 91 others); Mon, 21 Nov 2022 20:56:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbiKVB4W (ORCPT ); Mon, 21 Nov 2022 20:56:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CBC2643C for ; Mon, 21 Nov 2022 17:56:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3F10C6152D for ; Tue, 22 Nov 2022 01:56:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CDDDC433D6; Tue, 22 Nov 2022 01:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1669082180; bh=JGk0ZxCYS42fSPPpUoBTd3yoEazg4HSkfZ8gjdsUELw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=suWLKTl+EwRj/3rirO4twtMpjXhSrKSOovRtn/X9D4P2KQYm2HqFS6FPdHrSVAy3M oBnzNHYoYWO/5h2yVzfsUL61mQ2uEM1nrTgy17XghzfOZbpDpUklxl4+XaPMRiFm0G +O5DCgC2zqudAl4TsFQnO10jvW8R6CDL8EMLSdhs= Date: Mon, 21 Nov 2022 17:56:19 -0800 From: Andrew Morton To: Sergey Senozhatsky Cc: Seth Jennings , Dan Streetman , Vitaly Wool , Nhat Pham , Johannes Weiner , Minchan Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] zswap: do not allocate from atomic pool Message-Id: <20221121175619.f38259bac177de86bd9eb558@linux-foundation.org> In-Reply-To: <20221122013338.3696079-1-senozhatsky@chromium.org> References: <20221122013338.3696079-1-senozhatsky@chromium.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, 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 Tue, 22 Nov 2022 10:33:38 +0900 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 there. Use GFP_KERNEL instead. > > ... > > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -1314,7 +1314,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; It seems strange to do if (! can sleep) do something which can sleep or am I misreading the intent of zpool_driver.sleep_mapped? If so, perhaps some explanatory code comments will help.