From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by kanga.kvack.org (Postfix) with ESMTP id 879906B026C for ; Mon, 4 Apr 2016 08:06:30 -0400 (EDT) Received: by mail-lb0-f172.google.com with SMTP id bc4so157092456lbc.2 for ; Mon, 04 Apr 2016 05:06:30 -0700 (PDT) Received: from mail-lb0-x235.google.com (mail-lb0-x235.google.com. [2a00:1450:4010:c04::235]) by mx.google.com with ESMTPS id q65si15756437lfd.123.2016.04.04.05.06.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Apr 2016 05:06:27 -0700 (PDT) Received: by mail-lb0-x235.google.com with SMTP id vo2so158282124lbb.1 for ; Mon, 04 Apr 2016 05:06:27 -0700 (PDT) Date: Mon, 4 Apr 2016 15:06:25 +0300 From: "Kirill A. Shutemov" Subject: Re: mm: BUG in khugepaged_scan_mm_slot Message-ID: <20160404120625.GA6133@node.shutemov.name> References: <5702582A.1030904@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5702582A.1030904@suse.cz> Sender: owner-linux-mm@kvack.org List-ID: To: Vlastimil Babka Cc: Dmitry Vyukov , Andrew Morton , "Kirill A. Shutemov" , "linux-mm@kvack.org" , LKML , Hugh Dickins , Greg Thelen , Konstantin Khlebnikov , syzkaller , Kostya Serebryany , Alexander Potapenko , Sasha Levin , Andrea Arcangeli On Mon, Apr 04, 2016 at 02:03:54PM +0200, Vlastimil Babka wrote: > [+CC Andrea] > > On 04/02/2016 11:48 AM, Dmitry Vyukov wrote: > >Hello, > > > >The following program triggers a BUG in khugepaged_scan_mm_slot: > > > > > >vma ffff880032698f90 start 0000000020c57000 end 0000000020c58000 > >next ffff88003269a1b8 prev ffff88003269ac18 mm ffff88005e274780 > >prot 35 anon_vma ffff88003182c000 vm_ops (null) > >pgoff fed00 file ffff8800324552c0 private_data (null) > >flags: 0x5144477(read|write|exec|mayread|maywrite|mayexec|pfnmap|io|dontexpand|account) > >------------[ cut here ]------------ > >kernel BUG at mm/huge_memory.c:2313! > >invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN > > That's VM_BUG_ON_VMA(vma->vm_flags & VM_NO_THP, vma) in > hugepage_vma_check(). > > #define VM_NO_THP (VM_SPECIAL | VM_HUGETLB | VM_SHARED | VM_MAYSHARE) > > #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP) > > Of those, we have VM_IO | VM_DONTEXPAND. > > I don't know if it's valid for a vma with anon_vma to have such flags, if > yes, we should probably modify hugepage_vma_check(). Called from > khugepaged_scan_mm_slot() it should just return false out VM_NO_THP. Called > from collapse_huge_page() it could keep the VM_BUG_ON. Or maybe just have > VM_BUG_ON(!hugepage_vma_check()) there? Hmm actually no, there's a mmap_sem > release for read and then acquire for write, so we can't rely on the check > done earlier from khugepaged_scan_mm_slot(). > > So we should probably just change the VM_BUG_ON to another "return false" > condition. Unless the VM_BUG_ON uncovered a real bug and the earlier > conditions in hugepage_vma_check() should guarantee the VM_BUG_ON be false > for any vma. http://lkml.kernel.org/r/145961146490.28194.16019687861681349309.stgit@zurg -- Kirill A. Shutemov -- 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