Received: by 10.223.185.116 with SMTP id b49csp1053614wrg; Sun, 11 Feb 2018 03:31:22 -0800 (PST) X-Google-Smtp-Source: AH8x2272HNPgbgGX6WmyZx/8TVWO51ejOSMJ/TscdL+YD3LH4npwYGEaftMj42lDCDdRRRKGDrZx X-Received: by 2002:a17:902:1665:: with SMTP id g92-v6mr7879254plg.245.1518348682011; Sun, 11 Feb 2018 03:31:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518348681; cv=none; d=google.com; s=arc-20160816; b=FoBCAupqBNbxGuvkRfnQNfCs7XATu/xoWxSK9cztsphiAsd0Elg+rOmd2tI9VfyTgu V7qQ6sqk0pwcZQO0wh3VK8eJpFHMaEnCO/f8iMbL/jmFG273BB0rFCf2+Q2uG5+a4kNn uitonGu9MMfqV7IwZv6GbESIndAZpEWEqexigCGkaPYnnG7xTJgfjIJgCadB/hkAPE4V N6ds5EKzrLTiF2PYUk9V7lrw5gKmeVqpvogrGxdr5TKLxt+aEBKrfv8dZ3bEskTz22r0 1AzzC55bdlsixOZ9mL41oayEeSTEVqhwruU+SnoUgqSmfQu44JVTS/YNc10ZdmQ9vzaO pejQ== 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:dkim-signature :arc-authentication-results; bh=OU7zxo7oFvZGWXsgcsPawTIQ0liRPQrAAcdY9WGnvwM=; b=e3QXdQpSmcn/72BK3D2RaOMBzFaCPoCVCSCtzJZnpciEJyOOKFgjsyV2u2rYSiZzYr 081IsNnEx2YBrJzQ6vk5sVhsWrY9PPNPf67lKzMDlfyhvEJFKn95RNje0RKEOMmltmh9 YPYLrD7173fmKryN7UF/WcZzkp9WcpdzH0EbOvh/Amrju/Co8W/ziDA2wawVrzyAMbjG vG838LaSU6GJxMXo6DGNbiRx2z1bNRftFPfMBJhFelxj8TQnl5Syk+1tS3cytk+xfuma LXLacYXZ7KVV1tRzmmxqDtK/puAu16S5UsrvkJyToRxgGvnNd1iC8/ly8qH942r2Ev0+ WjMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=nXqH2FLC; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZIoeU/Ue; 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 n16si3868500pgv.426.2018.02.11.03.31.06; Sun, 11 Feb 2018 03:31:21 -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=casper.20170209 header.b=nXqH2FLC; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZIoeU/Ue; 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 S1753090AbeBKLaY (ORCPT + 99 others); Sun, 11 Feb 2018 06:30:24 -0500 Received: from casper.infradead.org ([85.118.1.10]:53408 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753024AbeBKLaW (ORCPT ); Sun, 11 Feb 2018 06:30:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=OU7zxo7oFvZGWXsgcsPawTIQ0liRPQrAAcdY9WGnvwM=; b=nXqH2FLC5TFQCI+vPpQ+4Psn4 mtGx8IOv8ZgTjIltYK8cbj8TmgyauV2iCuEImMX8hTdKPBzqnySm2rJ8wcPj1RU3bhLGP+LpIYoOf RKJUcv7EOsbmGrekA0SgLeKHIFgn/bSDtuiSU2WEf+JQE37ES7y9F96zbA/ykGFmMwWVi9hPddBKj MPuK3M5ROMyszmGR/lX2MNnrIT4FkKJSTtereE9WHDoJe0c0Hldv+FHT00vYVDrgQSP2fNkne3Qx6 k9PjfIOe5eijIauVkXCfheE3CcZ1FLJh7dhrOo0ACom4cQGcTqqrEpV7By2iD6mR+IKPjD83TxOHA PSzwGWRVA==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ekppf-0006uk-Ao; Sun, 11 Feb 2018 11:30:07 +0000 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=OU7zxo7oFvZGWXsgcsPawTIQ0liRPQrAAcdY9WGnvwM=; b=ZIoeU/Ue1DYiFCXhSALNGB1e4 hQLVB3WGazNn7cMzzQo09yU8qBODoQrvqQlEkra/Wm8cN5CkvMBr5mWha81mPUC+RqBefzjbVfIC3 6mCfQ1/ZNBouN0SwHZiLqwWsHYajx1xUZRrdJUmB92+ysw5+EZN53eamvwJnEyKuR0fzx0ECn7ymT BpO9DWMhA2VZ2Hv2HETKm6JMrskV4xuC90keukj2eS6iAIAOTKEn/8qUaQODvCdG9S8bfpVbV1e6s ffj1hHjpf4hUrbrMvncttQU7Ko+h26We1qI6/o4P8eE6YE2R3US1MqSVztWbGhU0GRWMnaqhGhJAo WVIUjTJsQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1ekpnk-000402-OO; Sun, 11 Feb 2018 11:28:08 +0000 Date: Sun, 11 Feb 2018 03:28:08 -0800 From: Matthew Wilcox To: Michal Hocko Cc: Kai Heng Feng , Laura Abbott , linux-mm@kvack.org, Linux Kernel Mailing List Subject: Re: Regression after commit 19809c2da28a ("mm, vmalloc: use __GFP_HIGHMEM implicitly") Message-ID: <20180211112808.GA4551@bombadil.infradead.org> References: <627DA40A-D0F6-41C1-BB5A-55830FBC9800@canonical.com> <20180208130649.GA15846@bombadil.infradead.org> <20180208232004.GA21027@bombadil.infradead.org> <20180211092652.GV21609@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180211092652.GV21609@dhcp22.suse.cz> 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 Sun, Feb 11, 2018 at 10:26:52AM +0100, Michal Hocko wrote: > On Thu 08-02-18 15:20:04, Matthew Wilcox wrote: > > ... nevertheless, 19809c2da28a does in fact break vmalloc_32 on 32-bit. Look: > > > > #if defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA32) > > #define GFP_VMALLOC32 GFP_DMA32 | GFP_KERNEL > > #elif defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA) > > #define GFP_VMALLOC32 GFP_DMA | GFP_KERNEL > > #else > > #define GFP_VMALLOC32 GFP_KERNEL > > #endif > > > > So we pass in GFP_KERNEL to __vmalloc_node, which calls __vmalloc_node_range > > which calls __vmalloc_area_node, which ORs in __GFP_HIGHMEM. > > Dohh. I have missed this. I was convinced that we always add GFP_DMA32 > when doing vmalloc_32. Sorry about that. The above definition looks > quite weird to be honest. First of all do we have any 64b system without > both DMA and DMA32 zones? If yes, what is the actual semantic of > vmalloc_32? Or is there any magic forcing GFP_KERNEL into low 32b? mmzone.h has the following, which may be inaccurate / out of date: * parisc, ia64, sparc <4G * s390 <2G * arm Various * alpha Unlimited or 0-16MB. * * i386, x86_64 and multiple other arches * <16M. It claims ZONE_DMA32 is x86-64 only, which is incorrect; it's now used by arm64, ia64, mips, powerpc, tile. > Also I would expect that __GFP_DMA32 should do the right thing on 32b > systems. So something like the below should do the trick Oh, I see. Because we have: #ifdef CONFIG_ZONE_DMA32 #define OPT_ZONE_DMA32 ZONE_DMA32 #else #define OPT_ZONE_DMA32 ZONE_NORMAL #endif we'll end up allocating from ZONE_NORMAL if a non-DMA32 architecture asks for GFP_DMA32 memory. Thanks; I missed that. I'd recommend this instead then: #if defined(CONFIG_64BIT) && !defined(CONFIG_ZONE_DMA32) #define GFP_VMALLOC32 GFP_DMA | GFP_KERNEL #else #define GFP_VMALLOC32 GFP_DMA32 | GFP_KERNEL #endif I think it's clearer than the three-way #if. Now, longer-term, perhaps we should do the following: #ifdef CONFIG_ZONE_DMA32 #define OPT_ZONE_DMA32 ZONE_DMA32 #elif defined(CONFIG_64BIT) #define OPT_ZONE_DMA OPT_ZONE_DMA #else #define OPT_ZONE_DMA32 ZONE_NORMAL #endif Then we wouldn't need the ifdef here and could always use GFP_DMA32 | GFP_KERNEL. Would need to audit current users and make sure they wouldn't be broken by such a change. I noticed a mistake in 704b862f9efd; - pages = __vmalloc_node(array_size, 1, nested_gfp|__GFP_HIGHMEM, + pages = __vmalloc_node(array_size, 1, nested_gfp|highmem_mask, We should unconditionally use __GFP_HIGHMEM here instead of highmem_mask because this is where we allocate the array to hold the struct page pointers. This can be allocated from highmem, and does not need to be allocated from ZONE_NORMAL. Similarly, - if (gfpflags_allow_blocking(gfp_mask)) + if (gfpflags_allow_blocking(gfp_mask|highmem_mask)) is not needed (it's not *wrong*, it was just an unnecessary change). > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index 673942094328..2eab5d1ef548 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -1947,7 +1947,8 @@ void *vmalloc_exec(unsigned long size) > #elif defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA) > #define GFP_VMALLOC32 GFP_DMA | GFP_KERNEL > #else > -#define GFP_VMALLOC32 GFP_KERNEL > +/* This should be only 32b systems */ > +#define GFP_VMALLOC32 GFP_DMA32 | GFP_KERNEL > #endif > > /** > > -- > Michal Hocko > SUSE Labs > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org