From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by kanga.kvack.org (Postfix) with ESMTP id D32F06B0311 for ; Wed, 26 Jul 2017 04:33:55 -0400 (EDT) Received: by mail-wr0-f198.google.com with SMTP id q50so30987646wrb.14 for ; Wed, 26 Jul 2017 01:33:55 -0700 (PDT) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com. [209.85.128.193]) by mx.google.com with ESMTPS id i4si17479985wra.237.2017.07.26.01.33.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 01:33:54 -0700 (PDT) Received: by mail-wr0-f193.google.com with SMTP id y43so21538222wrd.0 for ; Wed, 26 Jul 2017 01:33:54 -0700 (PDT) From: Michal Hocko Subject: [RFC PATCH 4/5] mm, sparse: complain about implicit altmap usage in vmemmap_populate Date: Wed, 26 Jul 2017 10:33:32 +0200 Message-Id: <20170726083333.17754-5-mhocko@kernel.org> In-Reply-To: <20170726083333.17754-1-mhocko@kernel.org> References: <20170726083333.17754-1-mhocko@kernel.org> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: Andrew Morton , Mel Gorman , Vlastimil Babka , Andrea Arcangeli , Jerome Glisse , Reza Arbab , Yasuaki Ishimatsu , qiuxishi@huawei.com, Kani Toshimitsu , slaoub@gmail.com, Joonsoo Kim , Andi Kleen , Daniel Kiper , Igor Mammedov , Vitaly Kuznetsov , LKML , Michal Hocko From: Michal Hocko All current users of the altmap are in the memory hotplug code and they use __vmemmap_populate explicitly (via __sparse_mem_map_populate). Complain if somebody uses vmemmap_populate with altmap registered because that could be an unexpected usage. Also call __vmemmap_populate with NULL from that code path. Signed-off-by: Michal Hocko --- include/linux/mm.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 3ce673570fb8..ae1fa053d09e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2456,8 +2456,12 @@ int __vmemmap_populate(unsigned long start, unsigned long end, int node, static inline int vmemmap_populate(unsigned long start, unsigned long end, int node) { - struct vmem_altmap *altmap = to_vmem_altmap(start); - return __vmemmap_populate(start, end, node, altmap); + /* + * All users of the altmap have to be explicit and use + * __vmemmap_populate directly + */ + WARN_ON(to_vmem_altmap(start)); + return __vmemmap_populate(start, end, node, NULL); } void vmemmap_populate_print_last(void); -- 2.13.2 -- 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