Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757196AbcC2MVL (ORCPT ); Tue, 29 Mar 2016 08:21:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:56608 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757172AbcC2MVJ (ORCPT ); Tue, 29 Mar 2016 08:21:09 -0400 Subject: Re: [PATCH] mm: fix invalid node in alloc_migrate_target() To: Xishi Qiu References: <56F4E104.9090505@huawei.com> <20160325122237.4ca4e0dbca215ccbf4f49922@linux-foundation.org> <56F61EC8.7080508@huawei.com> <56FA5062.2020103@suse.cz> <56FA5AF5.30006@huawei.com> Cc: Andrew Morton , Joonsoo Kim , David Rientjes , Naoya Horiguchi , Laura Abbott , zhuhui@xiaomi.com, wangxq10@lzu.edu.cn, Linux MM , LKML , Dave Hansen From: Vlastimil Babka Message-ID: <56FA732E.9020906@suse.cz> Date: Tue, 29 Mar 2016 14:21:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <56FA5AF5.30006@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 875 Lines: 20 On 03/29/2016 12:37 PM, Xishi Qiu wrote: > On 2016/3/29 17:52, Vlastimil Babka wrote: >> The code in this functions seems to come from 099730d67417d ("mm, hugetlb: use memory policy when available") by Dave Hansen (adding to CC), which was indeed merged in 4.4-rc1. >> >> However, alloc_pages_node() is only called in the block guarded by: >> >> if (!IS_ENABLED(CONFIG_NUMA) || !vma) { >> >> The rather weird "!IS_ENABLED(CONFIG_NUMA)" part comes from immediate followup commit e0ec90ee7e6f ("mm, hugetlbfs: optimize when NUMA=n") >> >> So I doubt the code path here can actually happen. But it's fragile and confusing nevertheless. >> > > Hi Vlastimil > > __alloc_buddy_huge_page(h, NULL, addr, nid); // so the vma is NULL Hm that's true, I got lost in the logic, thanks. But the problem with dequeue_huge_page_node() is also IMHO true, and older, so we should fix 3.12+.