Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3642651pxb; Mon, 30 Aug 2021 07:17:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJzjtD8Qd3FpahdAh5C4sTH39WIrc5UHrw5174rsKOP7vW+k8zdWjLuZ63Vbkfg4gDlS5o X-Received: by 2002:a17:906:c1d0:: with SMTP id bw16mr25587531ejb.146.1630333067052; Mon, 30 Aug 2021 07:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630333067; cv=none; d=google.com; s=arc-20160816; b=QrgPKnPmEVCxKSSsdnZzXxAnDIPNVF13ifkfhFSraP3Fl7C1jJHc7Qtj+rdMpqRPuQ 78/o8tfx08iYdqhNRmTvpvQWo9Vqqcm4m19Ra3QVTWMgr5FGO80jsg9uXn6oLPguwLQ8 yhM1Z0nlGCqMzdaFg9DVKFPFIqCFKy8MK1yAWVZXcHCNb+mdjwzopkIBI+oU0BLtVwa2 141Zc3ZfdGzESqaYDdL/9QOgMIn0+ZKilBfaPRjQdxN0wO2vg2F2KUXFe78iZphzcV+O eKiS2BXtH1TXhPu8R13CYZUM1S//+aJrW5Amq0s+rse6uHNxZ2WT79PHpyeTTCQzRLe9 JLNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3Gc97wsiAlSFzBOt+yVTSl01Moe6XU2cGOQUXx5s6SU=; b=bWeC0jIXRNnokdnUZW5L4/YGF+z/I0OAnK+nS8u7BWMWPP7SIwXkc6Cpm05HwFB6aA PmSioydAUOcvO6XuU29hkp71Yk4l1o6z6x2l6FG7rJwd56yV7LrLWn/T2G/8FGPUPq+x WZszfwPAbRs7GaivJw/gb8lvIPHTSmDidbJqH9CRxJ1pKE5WY8MdhqoWwez2jzwmXQcr kAle8qYaxIpwoV5eIJECOsxUA862mRrHxaEW0dk2EOdhJ9mrkASPNuBpvapyLfPzo8z4 riD4bm0Jpu5OhJxorR0wUG0gOOyUYkJoNZ6YouytGdfDZpy+LES45H635/g2nVHOUiuV hYQA== 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 o11si2831864ejy.49.2021.08.30.07.17.11; Mon, 30 Aug 2021 07:17:47 -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 S237080AbhH3OLg (ORCPT + 99 others); Mon, 30 Aug 2021 10:11:36 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:8799 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237013AbhH3OLU (ORCPT ); Mon, 30 Aug 2021 10:11:20 -0400 Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Gysdh18HSzYvS8; Mon, 30 Aug 2021 22:09:44 +0800 (CST) Received: from huawei.com (10.175.124.27) 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; Mon, 30 Aug 2021 22:10:23 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH 6/6] mm/page_alloc.c: avoid allocating highmem pages via alloc_pages_exact_nid() Date: Mon, 30 Aug 2021 22:10:51 +0800 Message-ID: <20210830141051.64090-7-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210830141051.64090-1-linmiaohe@huawei.com> References: <20210830141051.64090-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 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. Signed-off-by: Miaohe Lin --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d87b7e6e9e6b..858fd45ecaea 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5639,7 +5639,7 @@ void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask) if (WARN_ON_ONCE(gfp_mask & __GFP_COMP)) gfp_mask &= ~__GFP_COMP; - p = alloc_pages_node(nid, gfp_mask, order); + p = alloc_pages_node(nid, gfp_mask & ~__GFP_HIGHMEM, order); if (!p) return NULL; return make_alloc_exact((unsigned long)page_address(p), order, size); -- 2.23.0