Received: by 10.223.176.5 with SMTP id f5csp429940wra; Fri, 9 Feb 2018 01:14:06 -0800 (PST) X-Google-Smtp-Source: AH8x226EvnzwpnqJP2j1HCqoPCtCF0x6+15WpXybtQ6C8LGBUVYWzOS0RQXm32zIvDgavsTo/690 X-Received: by 2002:a17:902:261:: with SMTP id 88-v6mr285276plc.384.1518167646751; Fri, 09 Feb 2018 01:14:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518167646; cv=none; d=google.com; s=arc-20160816; b=clTO3om6T9FYD7b9wOKGUZCwmCXkF1YqFG9uQDieKNxL9dECPtumskfJHbdzMmaP9U NEmdBhFmcJCTmdW0z728+A4alkGT0MMQqGN2hFiW2eN4LZ7ZzvQASEZfX0bUz1PDjdks 0wzzdScHo9BwesQDy9cJDlMHqZP7LtM4V0adkMsvVr2NQ6pBFmkQwrvkMrqnQWMcWQnd NX2xoSeHnw7HERnYsf9+r6V/9XMr0MMU3mJox73464rqCT8OyCQS7gIndt5sJz09RuZh u7VJabvQCUCKpNxq4jxzym4novkktK8QYy5MLb7hI+LnWuiV9vXlMdW/vWdLdS8oLWwq qugA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:arc-authentication-results; bh=jHfrrZ7D+fAiIhHir/1WsMl3owuyiNt9kxjnrSYcSZA=; b=QwbkW5RzfIgdGqIed8/RfyN51z5mC+usoeFvQYSRDMtmzx2ZDyK4UEbKDpFVma9VJj 4x7+BS0hwZ15J/KckIi3iFhTiPc0RXOB9HoYfNBcljA9ucg6xDl0wONNeSxS5zpaoijS aI7NQvMtye4R6hMGnvEw/hN7NWXTXEhtOY1DlQYcIn8Ue0BWcwTmciA1ukPIxlvd7WOl ti3VXWhjuQuISJfYuXNj3SMbmz4hZzKOF27XMr4IebeGwG4wcWyQF53otrZ4LJXXK2Z4 bMY5PoBlMHY5tR6b+ouweycQ8DQVMNL0Rum0iTt4sXxv+SO9VaW7Pm6KFI+r7igxckLS uieA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13si1133151pgs.339.2018.02.09.01.13.49; Fri, 09 Feb 2018 01:14:06 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751071AbeBIJNG (ORCPT + 99 others); Fri, 9 Feb 2018 04:13:06 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:58698 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750878AbeBIJND (ORCPT ); Fri, 9 Feb 2018 04:13:03 -0500 Received: from mail-pl0-f70.google.com ([209.85.160.70]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1ek4ju-0004ni-Ko for linux-kernel@vger.kernel.org; Fri, 09 Feb 2018 09:13:02 +0000 Received: by mail-pl0-f70.google.com with SMTP id f1so1804844plb.7 for ; Fri, 09 Feb 2018 01:13:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=jHfrrZ7D+fAiIhHir/1WsMl3owuyiNt9kxjnrSYcSZA=; b=IjVIflpHjWF5VYbVrIZLiLl1D+IBJwEoOKhlNB73+jIw1ryofd4X2pzuBxY+YzTrSG bG0JMp3XqISs0N/HtyocPS72Bz6Q9RUwuOFKNeycKpY7KRj7qeNjGsKjY7s7oB4iigm7 7Gi8nuJQx/aXz2YKoQqFM7bauMckJpuX2pCll+3SgjDkavxmY/JgUz3t0nUaAxNcycgv SQQTbORaW7Z0FpWADu0e+ebFfK8f1EGdaRFk8BNkYZDi5v7oMOlRpyuhpXeXq4UZS9uu rxgd/Mr6QSuwnrGGvcSZj7gNKO4pdwnX3lRHxfSNbyo6wpkjEy+86CfQanpuB4U+fE+R Ixfg== X-Gm-Message-State: APf1xPCI2GsmpBRtXG5l2YVUWd5GLk8CmjkAsDpig/inoYIu9VxGxMCe KNxXPuqpOBX/+TkOvnMGnXcPHWE8PLGKUzccu6RxRdGvielmRFPpxWiMmw1ve7yhZuqjwNN3QjX +hSLWHf7nswMNpeLIzdHCpHCMUPRbvJOD/ZxxUlOf3A== X-Received: by 10.99.67.133 with SMTP id q127mr1782671pga.365.1518167581282; Fri, 09 Feb 2018 01:13:01 -0800 (PST) X-Received: by 10.99.67.133 with SMTP id q127mr1782650pga.365.1518167580861; Fri, 09 Feb 2018 01:13:00 -0800 (PST) Received: from [10.101.46.95] ([175.41.48.77]) by smtp.gmail.com with ESMTPSA id y90sm4530847pfi.34.2018.02.09.01.12.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 01:13:00 -0800 (PST) Content-Type: text/plain; charset=us-ascii; delsp=yes; format=flowed Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.9\)) Subject: Re: Regression after commit 19809c2da28a ("mm, vmalloc: use __GFP_HIGHMEM implicitly") From: Kai Heng Feng In-Reply-To: <20180209040814.GA23828@bombadil.infradead.org> Date: Fri, 9 Feb 2018 17:12:56 +0800 Cc: Michal Hocko , Laura Abbott , linux-mm@kvack.org, Linux Kernel Mailing List Content-Transfer-Encoding: 7bit Message-Id: <2DB8D5E5-0955-47CF-A142-09A5BA71DF70@canonical.com> References: <627DA40A-D0F6-41C1-BB5A-55830FBC9800@canonical.com> <20180208130649.GA15846@bombadil.infradead.org> <20180208232004.GA21027@bombadil.infradead.org> <20180209040814.GA23828@bombadil.infradead.org> To: Matthew Wilcox X-Mailer: Apple Mail (2.3445.6.9) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matthew, > On Feb 9, 2018, at 12:08 PM, Matthew Wilcox wrote: > 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. IIUC, I need to let drivers/media drivers start using vmalloc_32() with your patch, right? Kai-Heng > > 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 > > /**