public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/1] make ld.so map .text LOAD ssegments and aligned by p_align
@ 2021-12-04  4:58 Rongwei Wang
  2021-12-04  4:58 ` [PATCH RFC 1/1] elf: align the mapping address of LOAD segments with p_align Rongwei Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 42+ messages in thread
From: Rongwei Wang @ 2021-12-04  4:58 UTC (permalink / raw)
  To: libc-alpha; +Cc: xuyu, gavin.dg

Hello, Glibc Maintainers and Developers:

We are software development engineers from Alibaba Cloud OS
team. We are mainly responsible for the development and
maintenance of Alibaba Cloud Linux. This is our first time
to send patch to glibc mail-list, if we ignore anything in
this patch, please let me know. Thanks very much!

Recently, we try to realize the feature that make .text and
.data application segments use huge pages (2M). At first, we
had realized the feature in kernel, refer to LINK[1]. But
the part that align the mapping address of LOAD segment was
regarded as hack way, if realized in kernel. If .text wants
to use huge pages, alignment of mapping address is necessary.
It refers to the first LOAD segment here. So, we think it
would be better to realize this part in glibc than kernel.

Actually, related discussion had been proposed in LINK[2, 3].
The implementation method in Patch 1/1 just need ld a simple
support, then application can call 'madvise' to mark .text
pages and collapse they into huge pages by 'khugepaged' thread.
(And We make a plan to provide a global sysfs inteface in OS
for .text hugepages, realizing transparent .text hugepages.
If you have an interested in this, a simple code works well
in LINK[1].)

What's more, we can see LINK[3] had mentioned .data and .text
segment using huge pages. In our patch, we just realizes the
.text part (first LOAD segment) and we think it's not necessary
for .data segments to use huge pages because of small and no
performance benefit in most applications.

This patch mainly move the part that aligns the mapping address
into ld.so. And the rest that realizes huge pages of the .text
is handed over to OS.

LINK:
[1] first patch in linux kernel:
https://patchwork.kernel.org/project/linux-mm/cover/20211009092658.59665-1-rongwei.wang@linux.alibaba.com/
[2] https://libc-alpha.sourceware.narkive.com/zqNSW0dY/glibc-loading-of-shared-objects-with-holes-wastes-address-space
[3] https://sourceware.org/pipermail/libc-alpha/2021-February/122331.html

Best regards,
Rongwei Wang

Rongwei Wang (1):
  elf: align the mapping address of LOAD segments with p_align

 elf/dl-load.c         |  1 +
 elf/dl-map-segments.h | 60 ++++++++++++++++++++++++++++++++++++++++---
 include/link.h        |  3 +++
 3 files changed, 60 insertions(+), 4 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2021-12-14  3:57 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04  4:58 [PATCH RFC 0/1] make ld.so map .text LOAD ssegments and aligned by p_align Rongwei Wang
2021-12-04  4:58 ` [PATCH RFC 1/1] elf: align the mapping address of LOAD segments with p_align Rongwei Wang
2021-12-04 18:10   ` Florian Weimer
2021-12-06  2:47     ` Rongwei Wang
2021-12-06 14:48   ` H.J. Lu
2021-12-08  2:14     ` Rongwei Wang
2021-12-08  2:33       ` H.J. Lu
2021-12-08  3:04         ` Rongwei Wang
2021-12-08 23:52           ` H.J. Lu
2021-12-09  1:43             ` Rongwei Wang
2021-12-10 12:39 ` [PATCH v5 0/2] fix p_align on PT_LOAD segment in DSO isn't honored Rongwei Wang
2021-12-10 12:39   ` [PATCH v5 1/2] elf: Properly align PT_LOAD segments Rongwei Wang
2021-12-10 15:43     ` H.J. Lu
2021-12-10 15:45       ` Florian Weimer
2021-12-10 18:54         ` H.J. Lu
2021-12-10 18:57           ` H.J. Lu
2021-12-10 12:39   ` [PATCH v5 2/2] Add a testcase to check alignment of PT_LOAD segment Rongwei Wang
2021-12-10 13:48     ` Adhemerval Zanella
2021-12-10 15:41       ` H.J. Lu
2021-12-10 18:56         ` H.J. Lu
2021-12-10 20:05           ` Adhemerval Zanella
2021-12-10 20:24             ` H.J. Lu
2021-12-10 21:34               ` Adhemerval Zanella
2021-12-10 13:13   ` [PATCH v5 0/2] fix p_align on PT_LOAD segment in DSO isn't honored H.J. Lu
2021-12-10 13:58     ` Rongwei Wang
2021-12-13  2:51 ` [PATCH v6 " Rongwei Wang
2021-12-13  2:51   ` [PATCH v6 1/2] elf: Properly align PT_LOAD segments [BZ #28676] Rongwei Wang
2021-12-13 11:05     ` Szabolcs Nagy
2021-12-13 11:17       ` Florian Weimer
2021-12-13 11:35         ` Szabolcs Nagy
2021-12-13 11:59           ` Florian Weimer
2021-12-13 13:20             ` H.J. Lu
2021-12-13 13:26               ` Florian Weimer
2021-12-13 13:34                 ` H.J. Lu
2021-12-13 11:46     ` Andreas Schwab
2021-12-13 11:52       ` Szabolcs Nagy
2021-12-13 14:51         ` Rongwei Wang
2021-12-13 17:37           ` Szabolcs Nagy
2021-12-13 17:50             ` Florian Weimer
2021-12-13  2:51   ` [PATCH v6 2/2] Add a testcase to check alignment of PT_LOAD segment Rongwei Wang
2021-12-14  2:03   ` [PATCH v6 0/2] fix p_align on PT_LOAD segment in DSO isn't honored Fangrui Song
2021-12-14  3:56     ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).