Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934200AbeALP0x (ORCPT + 1 other); Fri, 12 Jan 2018 10:26:53 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:39436 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933993AbeALP0v (ORCPT ); Fri, 12 Jan 2018 10:26:51 -0500 X-Originating-IP: 92.154.27.243 Subject: Re: [PATCH] mm, THP: vmf_insert_pfn_pud depends on CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD To: Andrew Morton Cc: Michal Hocko , linux-mm@kvack.org, kirill.shutemov@linux.intel.com, dan.j.williams@intel.com, zi.yan@cs.rutgers.edu, gregkh@linuxfoundation.org, n-horiguchi@ah.jp.nec.com, mark.rutland@arm.com, linux-kernel@vger.kernel.org References: <1515660811-12293-1-git-send-email-aghiti@upmem.com> <20180111100620.GY1732@dhcp22.suse.cz> <71853228-0beb-1e69-df47-59fa1bc5bd2f@upmem.com> <20180111162825.4cdaba2a21d8f15b21c45c75@linux-foundation.org> From: Alexandre Ghiti Message-ID: <01df063e-8cfd-11fd-a335-1e4a26377f95@upmem.com> Date: Fri, 12 Jan 2018 16:26:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180111162825.4cdaba2a21d8f15b21c45c75@linux-foundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 12/01/2018 01:28, Andrew Morton wrote: > On Thu, 11 Jan 2018 14:05:34 +0100 Alexandre Ghiti wrote: > >> On 11/01/2018 11:06, Michal Hocko wrote: >>> On Thu 11-01-18 09:53:31, Alexandre Ghiti wrote: >>>> The only definition of vmf_insert_pfn_pud depends on >>>> CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD being defined. Then its declaration in >>>> include/linux/huge_mm.h should have the same restriction so that we do >>>> not expose this function if CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD is >>>> not defined. >>> Why is this a problem? Compiler should simply throw away any >>> declarations which are not used? >> It is not a big problem but surrounding the declaration with the #ifdef >> makes the compilation of external modules fail with an "error: implicit >> declaration of function vmf_insert_pfn_pud" if >> CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD is not defined. I think it is >> cleaner than generating a .ko which would not load anyway. > Disagree. We'd have to put an absolutely vast amount of complex and > hard-to-maintain ifdefs in headers if we were to ensure that such > errors were to be detected at compile time. > > Whereas if we defer the detection of the errors until link time (or > depmod or modprobe time) then yes, a handful of people will detect > their mistake a minute or three later but that's a small cost compared > to permanently and badly messing up the header files. Ok, thanks for your time and explanations.