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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 C5636C4320A for ; Mon, 30 Aug 2021 14:27:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB76A60F5B for ; Mon, 30 Aug 2021 14:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237566AbhH3O1y (ORCPT ); Mon, 30 Aug 2021 10:27:54 -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().