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=-6.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 1F5FEC432BE for ; Wed, 1 Sep 2021 08:05:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 93D7A61053 for ; Wed, 1 Sep 2021 08:05:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 93D7A61053 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 2C3748D0001; Wed, 1 Sep 2021 04:05:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 272EF6B0071; Wed, 1 Sep 2021 04:05:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 162E58D0001; Wed, 1 Sep 2021 04:05:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0167.hostedemail.com [216.40.44.167]) by kanga.kvack.org (Postfix) with ESMTP id 094F26B006C for ; Wed, 1 Sep 2021 04:05:48 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C654C230F0 for ; Wed, 1 Sep 2021 08:05:47 +0000 (UTC) X-FDA: 78538270734.07.E4BD0F1 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf12.hostedemail.com (Postfix) with ESMTP id 484EB10000AA for ; Wed, 1 Sep 2021 08:05:47 +0000 (UTC) Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GzxRy4nFYzYwXJ; Wed, 1 Sep 2021 16:05:02 +0800 (CST) Received: from [10.174.178.75] (10.174.178.75) by dggeme703-chm.china.huawei.com (10.1.199.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Wed, 1 Sep 2021 16:05:44 +0800 Subject: Re: [PATCH 6/6] mm/page_alloc.c: avoid allocating highmem pages via alloc_pages_exact_nid() To: Vlastimil Babka , Matthew Wilcox CC: , , , , , References: <20210830141051.64090-1-linmiaohe@huawei.com> <20210830141051.64090-7-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Wed, 1 Sep 2021 16:05:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.75] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf12.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Stat-Signature: tafag9wknkeo939g96ydszb4qf9y5w84 X-Rspamd-Queue-Id: 484EB10000AA X-Rspamd-Server: rspam04 X-HE-Tag: 1630483547-590115 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 2021/9/1 0:37, Vlastimil Babka wrote: > On 8/31/21 03:56, Miaohe Lin wrote: >> On 2021/8/30 22:24, Matthew Wilcox wrote: >>> 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. >>> >> >> Yep, they can't work with GFP_HIGHMEM. So IMO it might be better to >> get rid of GFP_HIGHMEM explicitly or add a comment to clarify this >> situation to avoid future misbehavior. But this may be a unnecessary >> worry... Do you prefer to not change anything here? > > I agree with the suggestion below... > >> Many thanks. >> >>> 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(). > > ... which means __GFP_HIGHMEM would be stripped and additionally there would > be a warning. > Looks good for me. Will do. Many thanks! > . >