Received: by 10.223.176.5 with SMTP id f5csp214787wra; Thu, 8 Feb 2018 20:09:14 -0800 (PST) X-Google-Smtp-Source: AH8x227XPPg8Q8Z/WL+EOCTkdTRAh2k8bAqLz+qDA2KCHhJ9A+DVyBYEsjl/KeRJPOex8WJJVP4j X-Received: by 10.99.122.93 with SMTP id j29mr1211340pgn.351.1518149354190; Thu, 08 Feb 2018 20:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518149354; cv=none; d=google.com; s=arc-20160816; b=IAyh79iEGSAejosbnAfW+Tso28FQP0wN7axOHJ0P/zLfFoYARDAZOV2SdnpS2fHZtZ aa0EgklxH4sdnhWJgM+/3+bv26VhMA5v/FvbRT5aDbaW++V78++LrhTvzUkgablAckqk Y71iQehEkm5BwNk3jRF3o3gnP9nKdqAv+4KIkAHYmikOCjr/qrj12AbZe0lgNrwB5LpG PXnEC3h/bAFO679uT+ksXB9G5dQx4YtVhQV3g/7fADRJGgoqWT5/W/U2HkliarkVkXiz jt0Nubp9rNpyrdprs7N0KOkFT3Iifc6SSVbpxjcYVJ7qJPplTNLPjpoyvlTFn7/yDgb6 TRbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=eN3OGvM8aDB9o246WVS8Fsq7AKuefubzsPJqKlnJS2c=; b=YR0IVzHBAEDYbzn9qjiLqTOdrVX6R8r9/WxouQkIHcwwPYAlCWrvhW8PLE1f9fH5rr DOQMa8FovUewFhaBNrM4YDwsVK5eVW6+EG9wKWcM2yGYjaLQyh/CraBKIIjt+MCA0ba4 3SpLw2e/S7RCCIFH+iXEKN7BSTMTCNX5qWMvDyU/kZU7VdIWBgApgfDXleq4yhBVTtve S1WvMYMBvYXe0i4s/o0sKjh3cZg4iGtgGuGneXQD7kxC1CWCWCrBcO4zRClScryKnnVM /4jozyco3I7vjGiyS4DjzwOVdyKAqBMumY73uD8esPJBAwtRRAz73xNijYM+zEn9cQN6 njDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GrpK6rze; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si1011455plp.583.2018.02.08.20.08.58; Thu, 08 Feb 2018 20:09:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GrpK6rze; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752285AbeBIEIS (ORCPT + 99 others); Thu, 8 Feb 2018 23:08:18 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:49049 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752178AbeBIEIR (ORCPT ); Thu, 8 Feb 2018 23:08:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eN3OGvM8aDB9o246WVS8Fsq7AKuefubzsPJqKlnJS2c=; b=GrpK6rzeWJ6velCmPMhvv8tNT LmEeTQX1ankuyquNieZw2s4fnG1t3J3gkV/SAUAO0jGDVtMWbVtsLBV1BJ6hzhFMcR1U5d5Nb8Hvj P5AFnuWs9XIbrNRMZiROJNZQfCgWHpO79X1wr75+t7nCgEdNEHgAYVaZTOfjhsCpx+TaW/NNVRO9y ezHJzCGng9/UfIqFH07OY1FouyLXaRlMAxYRUwidNsSr1eD3LaZ7jCePNWh9I7/jHco7B4YkdMkXt ejRr28M7HSGV8l96w5ifiu+8ZK4zPxwd7dL06WKRMOu3lQzpO75zbAc1ViG5fzhSr1PUIQjMBaPVp ccBVjKtTA==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1ejzyw-0005Sx-Ie; Fri, 09 Feb 2018 04:08:14 +0000 Date: Thu, 8 Feb 2018 20:08:14 -0800 From: Matthew Wilcox To: Kai Heng Feng Cc: Michal Hocko , Laura Abbott , linux-mm@kvack.org, Linux Kernel Mailing List Subject: Re: Regression after commit 19809c2da28a ("mm, vmalloc: use __GFP_HIGHMEM implicitly") Message-ID: <20180209040814.GA23828@bombadil.infradead.org> References: <627DA40A-D0F6-41C1-BB5A-55830FBC9800@canonical.com> <20180208130649.GA15846@bombadil.infradead.org> <20180208232004.GA21027@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180208232004.GA21027@bombadil.infradead.org> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 08, 2018 at 03:20:04PM -0800, Matthew Wilcox wrote: > So ... we could enable ZONE_DMA32 on 32-bit architectures. I don't know > what side-effects that might have; it's clearly only been tested on 64-bit > architectures so far. > > It might be best to just revert 19809c2da28a and the follow-on 704b862f9efd. Alternatively, try this. It passes in GFP_DMA32 from vmalloc_32, regardless of whether ZONE_DMA32 exists or not. If ZONE_DMA32 doesn't exist, then we clear it in __vmalloc_area_node(), after using it to determine that we shouldn't set __GFP_HIGHMEM. diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 673942094328..91e8a95123c4 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1669,10 +1669,11 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, struct page **pages; unsigned int nr_pages, array_size, i; const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; - const gfp_t alloc_mask = gfp_mask | __GFP_NOWARN; - const gfp_t highmem_mask = (gfp_mask & (GFP_DMA | GFP_DMA32)) ? - 0 : - __GFP_HIGHMEM; + gfp_t alloc_mask = gfp_mask | __GFP_NOWARN; + if (!(alloc_mask & GFP_ZONEMASK)) + alloc_mask |= __GFP_HIGHMEM; + if (!IS_ENABLED(CONFIG_ZONE_DMA32) && (alloc_mask & __GFP_DMA32)) + alloc_mask &= ~__GFP_DMA32; nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; array_size = (nr_pages * sizeof(struct page *)); @@ -1680,7 +1681,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, area->nr_pages = nr_pages; /* Please note that the recursion is strictly bounded. */ if (array_size > PAGE_SIZE) { - pages = __vmalloc_node(array_size, 1, nested_gfp|highmem_mask, + pages = __vmalloc_node(array_size, 1, nested_gfp|__GFP_HIGHMEM, PAGE_KERNEL, node, area->caller); } else { pages = kmalloc_node(array_size, nested_gfp, node); @@ -1696,9 +1697,9 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, struct page *page; if (node == NUMA_NO_NODE) - page = alloc_page(alloc_mask|highmem_mask); + page = alloc_page(alloc_mask); else - page = alloc_pages_node(node, alloc_mask|highmem_mask, 0); + page = alloc_pages_node(node, alloc_mask, 0); if (unlikely(!page)) { /* Successfully allocated i pages, free them in __vunmap() */ @@ -1706,7 +1707,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, goto fail; } area->pages[i] = page; - if (gfpflags_allow_blocking(gfp_mask|highmem_mask)) + if (gfpflags_allow_blocking(gfp_mask)) cond_resched(); } @@ -1942,12 +1943,10 @@ void *vmalloc_exec(unsigned long size) NUMA_NO_NODE, __builtin_return_address(0)); } -#if defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA32) -#define GFP_VMALLOC32 GFP_DMA32 | GFP_KERNEL -#elif defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA) +#if defined(CONFIG_64BIT) && !defined(CONFIG_ZONE_DMA32) #define GFP_VMALLOC32 GFP_DMA | GFP_KERNEL #else -#define GFP_VMALLOC32 GFP_KERNEL +#define GFP_VMALLOC32 GFP_DMA32 | GFP_KERNEL #endif /**