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]
Message-ID: <CAHbLzkpZomZBHVkSpCiK-hZUoZi4x2N6MB=PtFj-cBHOVhYs7Q@mail.gmail.com>
Date: Wed, 20 Dec 2023 15:42:21 -0800
From: Yang Shi <shy828301@...il.com>
To: Fangrui Song <maskray@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org, 
	Song Liu <songliubraving@...com>, Miaohe Lin <linmiaohe@...wei.com>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: remove VM_EXEC requirement for THP eligibility

On Tue, Dec 19, 2023 at 9:41 PM Fangrui Song <maskray@...gle.com> wrote:
>
> Commit e6be37b2e7bd ("mm/huge_memory.c: add missing read-only THP
> checking in transparent_hugepage_enabled()") introduced the VM_EXEC
> requirement, which is not strictly needed.
>
> lld's default --rosegment option and GNU ld's -z separate-code option
> (default on Linux/x86 since binutils 2.31) create a read-only PT_LOAD
> segment without the PF_X flag, which should be eligible for THP.
>
> Certain architectures support medium and large code models, where
> .lrodata may be placed in a separate read-only PT_LOAD segment, which
> should be eligible for THP as well.

Yeah, it doesn't have to be VM_EXEC. The original implementation was
restricted to VM_EXEC to minimize the blast radius and the targe use
case is for large text segments. Out of curiosity, did you see any
noticeable improvement with this change?

>
> Signed-off-by: Fangrui Song <maskray@...gle.com>
> ---
>  include/linux/huge_mm.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index fa0350b0812a..4c9e67e9000f 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -126,7 +126,6 @@ static inline bool file_thp_enabled(struct vm_area_struct *vma)
>         inode = vma->vm_file->f_inode;
>
>         return (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS)) &&
> -              (vma->vm_flags & VM_EXEC) &&
>                !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode);
>  }
>
> --
> 2.43.0.472.g3155946c3a-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ