[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <01df063e-8cfd-11fd-a335-1e4a26377f95@upmem.com>
Date: Fri, 12 Jan 2018 16:26:09 +0100
From: Alexandre Ghiti <aghiti@...em.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Michal Hocko <mhocko@...nel.org>, linux-mm@...ck.org,
kirill.shutemov@...ux.intel.com, dan.j.williams@...el.com,
zi.yan@...rutgers.edu, gregkh@...uxfoundation.org,
n-horiguchi@...jp.nec.com, mark.rutland@....com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm, THP: vmf_insert_pfn_pud depends on
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
On 12/01/2018 01:28, Andrew Morton wrote:
> On Thu, 11 Jan 2018 14:05:34 +0100 Alexandre Ghiti <aghiti@...em.com> 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.
Powered by blists - more mailing lists