lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 8 Jul 2018 23:08:24 -0700
From:   Dan Williams <dan.j.williams@...el.com>
To:     "Huang, Ying" <ying.huang@...el.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Michal Hocko <mhocko@...e.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Shaohua Li <shli@...nel.org>, Hugh Dickins <hughd@...gle.com>,
        Minchan Kim <minchan@...nel.org>,
        Rik van Riel <riel@...hat.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
        zi.yan@...rutgers.edu, daniel.m.jordan@...cle.com
Subject: Re: [PATCH -mm -v4 01/21] mm, THP, swap: Enable PMD swap operations
 for CONFIG_THP_SWAP

On Sun, Jul 8, 2018 at 10:40 PM, Huang, Ying <ying.huang@...el.com> wrote:
> Dan Williams <dan.j.williams@...el.com> writes:
>
>> On Thu, Jun 21, 2018 at 8:55 PM Huang, Ying <ying.huang@...el.com> wrote:
>>>
>>> From: Huang Ying <ying.huang@...el.com>
>>>
>>> Previously, the PMD swap operations are only enabled for
>>> CONFIG_ARCH_ENABLE_THP_MIGRATION.  Because they are only used by the
>>> THP migration support.  We will support PMD swap mapping to the huge
>>> swap cluster and swapin the THP as a whole.  That will be enabled via
>>> CONFIG_THP_SWAP and needs these PMD swap operations.  So enable the
>>> PMD swap operations for CONFIG_THP_SWAP too.
>>>
>>> Signed-off-by: "Huang, Ying" <ying.huang@...el.com>
>>> Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
>>> Cc: Andrea Arcangeli <aarcange@...hat.com>
>>> Cc: Michal Hocko <mhocko@...e.com>
>>> Cc: Johannes Weiner <hannes@...xchg.org>
>>> Cc: Shaohua Li <shli@...nel.org>
>>> Cc: Hugh Dickins <hughd@...gle.com>
>>> Cc: Minchan Kim <minchan@...nel.org>
>>> Cc: Rik van Riel <riel@...hat.com>
>>> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
>>> Cc: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
>>> Cc: Zi Yan <zi.yan@...rutgers.edu>
>>> Cc: Daniel Jordan <daniel.m.jordan@...cle.com>
>>> ---
>>>  arch/x86/include/asm/pgtable.h |  2 +-
>>>  include/asm-generic/pgtable.h  |  2 +-
>>>  include/linux/swapops.h        | 44 ++++++++++++++++++++++--------------------
>>>  3 files changed, 25 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
>>> index 99ecde23c3ec..13bf58838daf 100644
>>> --- a/arch/x86/include/asm/pgtable.h
>>> +++ b/arch/x86/include/asm/pgtable.h
>>> @@ -1224,7 +1224,7 @@ static inline pte_t pte_swp_clear_soft_dirty(pte_t pte)
>>>         return pte_clear_flags(pte, _PAGE_SWP_SOFT_DIRTY);
>>>  }
>>>
>>> -#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
>>> +#if defined(CONFIG_ARCH_ENABLE_THP_MIGRATION) || defined(CONFIG_THP_SWAP)
>>
>> How about introducing a new config symbol representing the common
>> infrastructure between the two and have them select that symbol.
>
> The common infrastructure shared by two mechanisms is PMD swap entry.
> But I didn't find there are many places where the common infrastructure
> is used.  So I think it may be over-engineering to introduce a new
> config symbol but use it for so few times.
>
>> Would that also allow us to clean up the usage of
>> CONFIG_ARCH_ENABLE_THP_MIGRATION in fs/proc/task_mmu.c? In other
>> words, what's the point of having nice ifdef'd alternatives in header
>> files when ifdefs are still showing up in C files, all of it should be
>> optionally determined by header files.
>
> Unfortunately, I think it is not a easy task to wrap all C code via
> #ifdef in header files.  And it may be over-engineering to wrap them
> all.  I guess this is why there are still some #ifdef in C files.

That's the entire point. Yes, over-engineer the header files so the
actual C code is more readable.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ