Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3902615imu; Mon, 24 Dec 2018 10:52:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/U74PrroliOaBAvhoigmidxwuZJPM1ppErDLdtcqVKpk4G7V+pnidWCWM/Ovhtigc5VE/0U X-Received: by 2002:a62:c302:: with SMTP id v2mr14210570pfg.155.1545677537978; Mon, 24 Dec 2018 10:52:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545677537; cv=none; d=google.com; s=arc-20160816; b=LRtzwpFaQ8aalLwsbKVSeDA/TNYkBaVRdGPZOR/jXx4p+sSiZw82EiDj9boH2+J8RP Y9kWd86ehhrRrE4qSdcCzbuIpCixLMdBOjnNy18K4H+bFEIBDL1vArPw4QOhN8zuUptr sfub/1OSz6zS6VN1C3ZNrKENDMK+OdH3sGrNQNY8HHvQbnCErP+02xaUliKLb66zY7ih 1Nj/jtVBjoxCiIENCYk0IgEekmGTVlyuOkJepqG6whZlVxEq9AixTy8R/5O4y0fw1eQt 2fIk5trDs4TcSirF3yrl+SElnAAbaL58sbuu2ChUTmAJ9/3A9+0EJ4Kwt1p1IaRmmFaF GTbw== 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; bh=tEAWtzZy1YpgXn49rMAi9cAAMlkNjFRNWsBpvLeoRPU=; b=QSgyotMDJQCpJpi5yMJs6kKmH5MTwvOnYHn4g7GsL53nb4r1JkV14hWh0QWDvqrjUp Xy6pVDPoKbc3ul2J66TnZP3RdV9wWSzFJI6cs7+CHQSkQsBoAE54OIA/aNvAHI3mk5/E 3DESOF+ERRvVjkcKrss9sa4VJMJ7YEmD2zhCx5TMKtMvOKZXUuFX5eX7p9bnrNwTKNVx vHqXJQtOlDEC6iwGIJVIkUa5AEyjgtnxCJk7DAm+oF+A7s1LiELFKBPWe7OUArRiUuOP V17znY400PNUpLgzFbr6020ho+xbwXT6roo7rHjzQEgla8mhM09cWmy71H1tvvP4C6/r Mkiw== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r81si12109963pfr.164.2018.12.24.10.52.01; Mon, 24 Dec 2018 10:52:17 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725816AbeLXSvL (ORCPT + 99 others); Mon, 24 Dec 2018 13:51:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:49334 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725747AbeLXSvK (ORCPT ); Mon, 24 Dec 2018 13:51:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id F018CAF53; Mon, 24 Dec 2018 18:51:08 +0000 (UTC) Date: Mon, 24 Dec 2018 19:51:06 +0100 From: Michal Hocko To: Mike Rapoport , Andrew Morton Cc: Paul Oppenheimer , Vlastimil Babka , David Rientjes , Jan Kara , linux-mm@kvack.org, LKML Subject: Re: Bug with report THP eligibility for each vma Message-ID: <20181224185106.GC16738@dhcp22.suse.cz> References: <20181224074916.GB9063@dhcp22.suse.cz> <20181224121250.GA2070@rapoport-lnx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181224121250.GA2070@rapoport-lnx> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 24-12-18 14:12:51, Mike Rapoport wrote: > On Mon, Dec 24, 2018 at 08:49:16AM +0100, Michal Hocko wrote: > > [Cc-ing mailing list and people involved in the original patch] > > > > On Fri 21-12-18 13:42:24, Paul Oppenheimer wrote: > > > Hello! I've never reported a kernel bug before, and since its on the > > > "next" tree I was told to email the author of the relevant commit. > > > Please redirect me to the correct place if I've made a mistake. > > > > > > When opening firefox or chrome, and using it for a good 7 seconds, it > > > hangs in "uninterruptible sleep" and I recieve a "BUG" in dmesg. This > > > doesn't occur when reverting this commit: > > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=48cf516f8c. > > > Ive attached the output of decode_stacktrace.sh and the relevant dmesg > > > log to this email. > > > > > > Thanks > > > > > BUG: unable to handle kernel NULL pointer dereference at 00000000000000e8 > > > > Thanks for the bug report! This is offset 232 and that matches > > file->f_mapping as per pahole > > pahole -C file ./vmlinux | grep f_mapping > > struct address_space * f_mapping; /* 232 8 */ > > > > I thought that each file really has to have a mapping. But the following > > should heal the issue and add an extra care. > > > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index f64733c23067..fc9d70a9fbd1 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -66,6 +66,8 @@ bool transparent_hugepage_enabled(struct vm_area_struct *vma) > > { > > if (vma_is_anonymous(vma)) > > return __transparent_hugepage_enabled(vma); > > + if (!vma->vm_file || !vma->vm_file->f_mapping) > > + return false; > > if (shmem_mapping(vma->vm_file->f_mapping) && shmem_huge_enabled(vma)) > > return __transparent_hugepage_enabled(vma); > > We have vma_is_shmem(), it can be used to replace shmem_mapping() without > adding the check for !vma->vm_file Yes, this looks like a much better choice. Thanks! Andrew, could you fold this in instead. diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f64733c23067..e093cf5e4640 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -66,7 +66,7 @@ bool transparent_hugepage_enabled(struct vm_area_struct *vma) { if (vma_is_anonymous(vma)) return __transparent_hugepage_enabled(vma); - if (shmem_mapping(vma->vm_file->f_mapping) && shmem_huge_enabled(vma)) + if (vma_is_shmem(vma) && shmem_huge_enabled(vma)) return __transparent_hugepage_enabled(vma); return false; -- Michal Hocko SUSE Labs