Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp898505pxb; Wed, 1 Sep 2021 12:14:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkO+Bw3oXParDS1aRsgD7/hZlWPU0PQpaLMS/zob8gzA4jld6/uXSJamhnW4UWaGFwrFzk X-Received: by 2002:a5d:9617:: with SMTP id w23mr891199iol.115.1630523650392; Wed, 01 Sep 2021 12:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630523650; cv=none; d=google.com; s=arc-20160816; b=w72RAIrmwGmIh7dApU0/Z5upd9T+K+yvOYHGMk3OlWfh2zf157oeU6Z5mEqqXBrDt7 CnBN417NqstwpwlKUhNCYYytSHuV6rQ8e8IvdAKPV7s7JfASutuoOS7aFrjdum4ZBvs6 DfgMHhSO4yeIBBf2iGw9REESka+z2EKPjenNTGafL8uSnlbMcuqvdfO9KNMXtG9678u+ g2DVgKQTYYAGYRmWMTBRFSsRzNnQmy85y4yImF7etM6ku41L+6IPH/cG6La0pDvn1go5 SBC69bEN8PWD+JzHWyOqGogeNtNqPd1l6C3Vt+mpBudvCCPP14BetkMT3B8qB/mFLKgi p29A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=FKONabByC5mtZ/k8SmGDVj+X9bzauu5BCCULkep3oIE=; b=bUA/Mp+gwO4e2oEv3iUkjrz+NlfamkD51Q76XkbvBbghNn1IGWmc/2NJlbu56ExLaP N3jS7KRYlxLPvxfSML8N82mHnfl00/0b+wuJg9awyRb635XuK/tIldp1On+k3FJe56QK ylyBDOaAffZlb4YDRr+cvnuoezCKiAn6KsgRDVT4/jawECmz0az1mh0wvmAig2i/0jHN RVG+t8CH5p2GpR3nnikihswz0MDLOZVkMNZ25Z0BuKwH30ssNZNL3I/3eXzYxZTisQYA Na7BOtP1aFzwgPP4P65jtWu+CEpV32S0lmZFLVbtTEiCw4+0WbZ4tu/NNxA0pJaDeA2b i0MA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si248257jak.106.2021.09.01.12.13.56; Wed, 01 Sep 2021 12:14:10 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242902AbhIAIGq (ORCPT + 99 others); Wed, 1 Sep 2021 04:06:46 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:8995 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232072AbhIAIGo (ORCPT ); Wed, 1 Sep 2021 04:06:44 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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! > . >