Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3650610pxb; Mon, 30 Aug 2021 07:28:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhqEGtxdeAnFFeS6q1VZGOJsYaUlAD5xYVQ3MbZ8q5UXxq9/YJ+Ii3FWqAunAvUrvBEOGg X-Received: by 2002:a05:6402:b65:: with SMTP id cb5mr8774923edb.343.1630333716034; Mon, 30 Aug 2021 07:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630333716; cv=none; d=google.com; s=arc-20160816; b=TrUS3jtqn+rwXKdd1Htsv3AUmEizAztx+qMmMshqVFJj7Qtq2zavGm+EAlv+S+h6o0 Lo3/uuNonk0G3PNcSSbvUa6BnhtjGKprrcyDJrMt+r5LurX63nfQnDLPe1ddUEzegAo3 TL4Uex1Z5rUze3nN+zpZFWXCi1TjlgHcNzeBlYuHhFoOezk7IFnUVpmLnACNL1U+lPRg HIZ+6sNnkhsSIgVTrv1yiTauoCeijaGjEPjuGx3NmpLtq5+SZUiHa4QQZuhMR/9GjRgA s16W2vr2T9G3/82zZ6z8mWdae+C0SHDuCPqNEw74QgdSA/Q77HtBQfZ4eQrOPAgDpcyD m2kw== 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=hAzEvoe8QavvyMY1614AsLbQz9LG+GuYVMMP3swKQBQ=; b=AjwYpj2BVJzX/j/5Qm5l2Kw0iCzqD993ugyozdVMcPoUAWGM59wDpwKGjfHid1hVAD mbbaLNZwP+8w8qhVr95XPy8uWh02qxNOrb2m5C81TIcJuAwP1hC8T3H5nlVmTRFGtEI8 e3uon8oRbZuGu6CUZGHs5r51eZk0WYkZmMlV0PfTO9gxrbzlry7LjVriePHCgSitWuyR M4WwbOzxN95zsRkEw81fMyJFs5iomThG4YwYwNnLQoeiYzgfEqvYA+x9ueBHMZIAgAHf qj+LrCuxfyRron+bo5JcaB8/LbBCjNRow4pa0/5P0TH37FEUnPBLv4hYZn3XIP1WPoJg 3oLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OsbZFW16; 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 da27si14283105edb.317.2021.08.30.07.28.12; Mon, 30 Aug 2021 07:28:36 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=OsbZFW16; 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 S237528AbhH3O1x (ORCPT + 99 others); Mon, 30 Aug 2021 10:27:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237211AbhH3O1w (ORCPT ); Mon, 30 Aug 2021 10:27:52 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 018DEC061575 for ; Mon, 30 Aug 2021 07:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hAzEvoe8QavvyMY1614AsLbQz9LG+GuYVMMP3swKQBQ=; b=OsbZFW16L7Anah7yvA9S/TRG4l ZE4sQbE4o0XlrwQfrxDWwfDXlca0r/eK54oQ0aKExFtKo1UeE7DHqxND+Gaz6qiN24vuyNvVE6R49 XLE/VfbhRMWIFMPhapJ8HJJhfIgwH1a6ECfOWQx/bomIGJ1U0o3ZkUQ8+ed6wQ+mpks+D0CJlL0aK l3q5TI/ZJ04f3HFrHLhD+Dzr0513uvGFUwwURGebPx3OX6xOcWwFusK7Bsb1tmjBH0r5aXomdBQFz Nt8xK6NxdjRnpBA9y7LRP7USgXBdnxFSTxiSfTqycGTrQvVfpN5bPx42ef4N6hRCjXCOaqrJWwvRT 39eN9IJA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKiCs-000E4Q-HJ; Mon, 30 Aug 2021 14:24:30 +0000 Date: Mon, 30 Aug 2021 15:24:14 +0100 From: Matthew Wilcox To: Miaohe Lin Cc: akpm@linux-foundation.org, vbabka@suse.cz, sfr@canb.auug.org.au, peterz@infradead.org, mgorman@techsingularity.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/6] mm/page_alloc.c: avoid allocating highmem pages via alloc_pages_exact_nid() Message-ID: References: <20210830141051.64090-1-linmiaohe@huawei.com> <20210830141051.64090-7-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210830141051.64090-7-linmiaohe@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 30, 2021 at 10:10:51PM +0800, Miaohe Lin wrote: > Don't use with __GFP_HIGHMEM because page_address() cannot represent > highmem pages without kmap(). Newly allocated pages would leak as > page_address() will return NULL for highmem pages here. But It works > now because the only caller does not specify __GFP_HIGHMEM now. This is a misunderstanding of how alloc_pages_exact() / alloc_pages_exact_nid() work. You simply can't call them with GFP_HIGHMEM. If you really must change anything here, s/__GFP_COMP/(__GFP_COMP|__GFP_HIGHMEM)/g throughout both alloc_pages_exact() and alloc_pages_exact_nid().