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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 D75ADC4338F for ; Tue, 27 Jul 2021 17:31:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA09760E09 for ; Tue, 27 Jul 2021 17:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230178AbhG0RbW (ORCPT ); Tue, 27 Jul 2021 13:31:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbhG0RbV (ORCPT ); Tue, 27 Jul 2021 13:31:21 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26CA1C061757 for ; Tue, 27 Jul 2021 10:31:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=/5u/kL2/B/88RazFOk7B7gT7fQ27YXJaLficWp9tFRI=; b=Hjg1TmZsbkN99YT4XrirMDJZie rtGlKFshaHEmcn4QefRePBIAVjUnHmU5WBGSUDqvwKQD2kBtLwkyS2UIPh8LjOv28Z3iC1V+FWf/m c6NbPv/sBQ11DWVv98i/ZySUrDvupkI2btcB3x60SaNT5q3CfSGaoVgY8pNqeZXotnAZrMzYuR8tc 1jrmV4GZ3hyqDl4J5071b/Z1qFv3MT/TepEuuWsWytdq73QlqnpHXm/Kv70MXNQkBfYzb5ys/QC/H LK8X+ndEWMXMQFP77qhJKok1s94ZFuVQg6icJyd0u/M65RZFqUgzsDnHz70OwGEfAFyoaKQIhEt5x ztkQ/uWQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8QuS-00FF5H-Ri; Tue, 27 Jul 2021 17:30:36 +0000 Date: Tue, 27 Jul 2021 18:30:28 +0100 From: Matthew Wilcox To: Chen Wandun Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, wangkefeng.wang@huawei.com, weiyongjun1@huawei.com Subject: Re: [PATCH] mm/vmalloc: add missing __GFP_HIGHMEM flag for vmalloc Message-ID: References: <20210726032333.3404164-1-chenwandun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 26, 2021 at 12:05:44PM +0800, Chen Wandun wrote: > 在 2021/7/26 11:25, Matthew Wilcox 写道: > > On Mon, Jul 26, 2021 at 11:23:33AM +0800, Chen Wandun wrote: > > > struct page array can also be allocated in highmem during vmalloc, > > > that will ease the low memory stress in 32bit system. > > Huh? Where does it get kmapped in order to access it? (i misread your patch, apologies) > The struct page array contain numbers of pointer of struct page, it is used to save > > pages that allocated for vmalloc mapping in vmap_pages_range, it does't need to kmap. > > > The main idea of this patch is come from: > > https://lore.kernel.org/lkml/20170307141020.29107-1-mhocko@kernel.org/ you've misunderstood that patch. think about it: static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot, unsigned int page_shift, int node) { const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; (now nested_gfp has neither DMA nor DMA32 set) gfp_mask |= __GFP_NOWARN; if (!(gfp_mask & (GFP_DMA | GFP_DMA32))) gfp_mask |= __GFP_HIGHMEM; (we set HIGHMEM if DMA and DMA32 are both not set) area->pages = __vmalloc_node(array_size, 1, nested_gfp, node, area->caller); (we don't need to set HIGHMEM here because it will be set for us in the second call to __vmalloc_area_node)