Received: by 10.223.185.116 with SMTP id b49csp973827wrg; Sun, 11 Feb 2018 01:27:46 -0800 (PST) X-Google-Smtp-Source: AH8x226ZrLouMN2ygK4vcXHfFpJ0Hfo+fvpeu1fSDhTwLg7zpw4TFBT4qEonNtA4KcZLAk0uJKR8 X-Received: by 10.101.74.204 with SMTP id c12mr6792055pgu.408.1518341265999; Sun, 11 Feb 2018 01:27:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518341265; cv=none; d=google.com; s=arc-20160816; b=sMvkSue4vXuYZClZDovJCtdU385wHQVshUGPCYs4lHI0d9E/u18nXXrOanl8wAYBPz q14iVkG+61rvuCuW5Rwi3aGl17slked26MOSAGBDPK1UZSlt5vRFcDTopzNaLVCtkdKF bSplDoqiK7ghUeD88c5lHLS280ytxTgEEOIc8v9B86mG2tMApukRdlgE+Um3oU4WP7gp hs+k5NbScIh2NZ78JoWUoNiE1mti4z++CdW8/SkGQo/vQjwC/qtkjNlair5Yps0jsXRk Tw3231c1kgIUuO5b4bVq4ne9xzFuErTBfvikYMYFwhAaZ7FMDnffPXVaw51OD23o8U// Qrog== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=50F2U41b/A42PauSB9GzWtupj01Z75jgWm1PkxJ1ECQ=; b=G7haHb4CLXEdyBJAMbwUwJpYI97cla2kiR5CsEpM2DAf4yoZatmSEKs5KuicwR6IVA HSSYK90b9gC6QYSqtDjF7VS0bgpKyg03AM4efSMkmQ2JWxUyzpSvitFOjmFJqh4cy6Fo SfOnkI0ySVeWJz9Ox7qL63SVakBVaT9n8gXuTvtUIaLwpxzhzHw9EH+swcw6HzaI9d+L TZDkcATE+UUwLopbPhNjN8QHQFC1/Dttj7bjsFGQnUOoMOVHZK9sSMNSZMn704oU0hqq +LFhl2sRBPWKmk2grjFE3F0R2Ut8Z8rwYYHv9m2L9/J9AszHZyDS1OY8W03Z1elRl/fq 2WPA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si1836287pgq.380.2018.02.11.01.27.31; Sun, 11 Feb 2018 01:27:45 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752713AbeBKJ04 (ORCPT + 99 others); Sun, 11 Feb 2018 04:26:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:50842 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbeBKJ0y (ORCPT ); Sun, 11 Feb 2018 04:26:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4067BAC12; Sun, 11 Feb 2018 09:26:53 +0000 (UTC) Date: Sun, 11 Feb 2018 10:26:52 +0100 From: Michal Hocko To: Matthew Wilcox 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: <20180211092652.GV21609@dhcp22.suse.cz> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180208232004.GA21027@bombadil.infradead.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 08-02-18 15:20:04, Matthew Wilcox wrote: > On Thu, Feb 08, 2018 at 05:06:49AM -0800, Matthew Wilcox wrote: > > On Thu, Feb 08, 2018 at 02:29:57PM +0800, Kai Heng Feng wrote: > > > A user with i386 instead of AMD64 machine reports [1] that commit 19809c2da28a ("mm, vmalloc: use __GFP_HIGHMEM implicitlyā€¯) causes a regression. > > > BUG_ON(PageHighMem(pg)) in drivers/media/common/saa7146/saa7146_core.c always gets triggered after that commit. > > > > Well, the BUG_ON is wrong. You can absolutely have pages which are both > > HighMem and under the 4GB boundary. Only the first 896MB (iirc) are LowMem, > > and the next 3GB of pages are available to vmalloc_32(). > > ... 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? Also I would expect that __GFP_DMA32 should do the right thing on 32b systems. So something like the below should do the trick --- 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