Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4094494pxb; Mon, 30 Aug 2021 18:57:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynRpfhN0ZzF4Hu/9ivEu4CcGBEetqT5YOEs3aBI6d3TXRVaKZe74kakMyZkYn2KsoySgpp X-Received: by 2002:a92:d0d1:: with SMTP id y17mr19164045ila.91.1630375035974; Mon, 30 Aug 2021 18:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630375035; cv=none; d=google.com; s=arc-20160816; b=TWR9+r3BIfsqFblnkZvMVMARdXgN+CK/UZ8RFKrRKHCkT8NAohOyjV0qIZ2TuumoJp IPjU9TpeY883VW8xuNQjWZr5KE0Rl3qC3+WwyulaSB4b7uwlB+dkmHkZiKS4X2LMwdDS q7le3q+ey2pULiqU22uzft8bGZsfOClToikH5IiB1Lr0IGhy0aCJNeSEf+s1yU2W0W8o AKkpoPx5ymYg6WtputEeeJNKwe9SbfFsGYW3TMDCT9GjfzGfpwHA/kWP/lpiBWU71Tkq JmhcNZNnT0Id2SjckuajjAhYqqO3t23nk62iEEGnTrMDBe7RUuet1v2XbidNAcuqoL9L 8DDg== 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=qCtsa1QkCsQIZdY52fhddT5qQivwlAEjHlPZMr8qxQU=; b=xqxvbJ6EUPp+zv2LX5+rJtxyLlUjG2twKafMFcdFYzLh9Q7JVwxgLbwdYnErGkUVKE zMNoOhezuzHRhSsHQqD05ljHP5EcgZC4i308HMX7NGkkUloWgTKv1XcyNOhm1RgZPis8 ahhTBUfICLiiSeGRbdYcRQLlUuiJZ9eQUgbihkSFwfx/oCM4q3TQlxkNf52gjG35siA0 t4by8yXB53HmuM7YfGCXV6JXjBo1urNldyKgOQbVdJShFOdXUM6tEQy9opLeH3NSGGVR lU68NHflQ0DMLpKdNP1guMBbnehCcKLd8Q84ZoKoSQnpDpQotXJtEOK7QUz88NnkBefU Cy1Q== 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 k35si6499835jac.46.2021.08.30.18.57.03; Mon, 30 Aug 2021 18:57:15 -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 S239277AbhHaB5B (ORCPT + 99 others); Mon, 30 Aug 2021 21:57:01 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:9388 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235217AbhHaB5A (ORCPT ); Mon, 30 Aug 2021 21:57:00 -0400 Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Gz9Cp0018z8wNC; Tue, 31 Aug 2021 09:51:49 +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; Tue, 31 Aug 2021 09:56:03 +0800 Subject: Re: [PATCH 6/6] mm/page_alloc.c: avoid allocating highmem pages via alloc_pages_exact_nid() To: Matthew Wilcox CC: , , , , , , References: <20210830141051.64090-1-linmiaohe@huawei.com> <20210830141051.64090-7-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Tue, 31 Aug 2021 09:56:02 +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: dggems702-chm.china.huawei.com (10.3.19.179) 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/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? 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(). > . >