unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Song Bao Hua \(Barry Song\) via Libc-alpha" <libc-alpha@sourceware.org>
To: Huang Shijie <shijie@os.amperecomputing.com>,
	Florian Weimer <fweimer@redhat.com>
Cc: Huang Shijie via Libc-alpha <libc-alpha@sourceware.org>,
	"zwang@amperecomputing.com" <zwang@amperecomputing.com>,
	"willy@infradead.org" <willy@infradead.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"patches@amperecomputing.com" <patches@amperecomputing.com>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: RE: [PATCH] Add LD_NUMA_REPLICATION for glibc
Date: Fri, 3 Sep 2021 22:16:14 +0000	[thread overview]
Message-ID: <bf60f30c9db041a2ab17a2a942389d61@hisilicon.com> (raw)
In-Reply-To: <YTI8FyHQVZ+o1ZGP@hsj>



> -----Original Message-----
> From: Huang Shijie [mailto:shijie@os.amperecomputing.com]
> Sent: Saturday, September 4, 2021 3:16 AM
> To: Florian Weimer <fweimer@redhat.com>
> Cc: Huang Shijie via Libc-alpha <libc-alpha@sourceware.org>;
> carlos@systemhalted.org; zwang@amperecomputing.com;
> patches@amperecomputing.com; akpm@linux-foundation.org;
> torvalds@linux-foundation.org; viro@zeniv.linux.org.uk; willy@infradead.org;
> Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>; linux-mm@kvack.org
> Subject: Re: [PATCH] Add LD_NUMA_REPLICATION for glibc
> 
> On Fri, Sep 03, 2021 at 08:28:57AM +0200, Florian Weimer wrote:
> > * Huang Shijie via Libc-alpha:
> >
> > > This patch adds LD_NUMA_REPLICATION which influences the linkage of shared
> libraries at run time.
> > >
> > > If LD_NUMA_REPLICATION is set for program foo like this:
> > > 	#LD_NUMA_REPLICATION=1 ./foo
> > >
> > > At the time ld.so mmaps the shared libraries, it will uses
> > > 	mmap(, c->prot | PROT_WRITE, MAP_COPY | MAP_FILE | MAP_POPULATE,)
> > > for them, and the mmap will trigger COW(copy on write) for the shared
> > > libraries at the NUMA node which the program `foo` runs. After the
> > > COW, the foo will have a copy of the shared library segment(mmap
> > > covered) which belong to the same NUMA node.
> > >
> > > So when enable LD_NUMA_REPLICATION, it will consume more memory,
> > > but it will reduce the remote-access in NUMA.
> >
> > I think the kernel could do this in a much better way, avoiding
> > duplicating the pages within the same NUMA node.
> I think maybe only the per-NUMA-node page cache can avoid it..
> 
> >
> > The other issue is the temporary RWX mapping, which does not
> > interoperate well with some security hardening features.
> >
> Thanks for the feedback.
> I CC more people who may  have interesting about this.
> 

Hi Shijie,
Thanks!

Could we have some benchmark data for this patch? I assume it
will benefit frontend-bound large workset which might face
relatively more icache miss?

> 
> Thanks
> Huang Shijie

Thanks
Barry


  reply	other threads:[~2021-09-03 22:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 12:14 [PATCH] Add LD_NUMA_REPLICATION for glibc Huang Shijie via Libc-alpha
2021-09-03  6:28 ` Florian Weimer via Libc-alpha
2021-09-03 15:15   ` Huang Shijie via Libc-alpha
2021-09-03 22:16     ` Song Bao Hua (Barry Song) via Libc-alpha [this message]
2021-09-06  9:14       ` Huang Shijie via Libc-alpha
2021-09-09 10:19   ` Huang Shijie via Libc-alpha
2021-09-10 11:01     ` Florian Weimer via Libc-alpha
2021-09-13 14:40       ` Huang Shijie via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf60f30c9db041a2ab17a2a942389d61@hisilicon.com \
    --to=libc-alpha@sourceware.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweimer@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=patches@amperecomputing.com \
    --cc=shijie@os.amperecomputing.com \
    --cc=song.bao.hua@hisilicon.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=zwang@amperecomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).