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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 8A20DC432BE for ; Mon, 30 Aug 2021 14:27:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2790560F57 for ; Mon, 30 Aug 2021 14:27:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2790560F57 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 688E36B0071; Mon, 30 Aug 2021 10:27:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 638536B0072; Mon, 30 Aug 2021 10:27:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 527798D0001; Mon, 30 Aug 2021 10:27:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id 437C66B0071 for ; Mon, 30 Aug 2021 10:27:00 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 092BB24892 for ; Mon, 30 Aug 2021 14:27:00 +0000 (UTC) X-FDA: 78531973800.15.0D50717 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 42E0FB000185 for ; Mon, 30 Aug 2021 14:26:59 +0000 (UTC) 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> X-Rspamd-Queue-Id: 42E0FB000185 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=OsbZFW16; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam01 X-Stat-Signature: ekk4893kwm3s3ptxxk9r1qofwgmzg4g8 X-HE-Tag: 1630333619-900416 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 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().