From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 008CD1F8C6 for ; Fri, 3 Sep 2021 06:29:26 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB41B386481A for ; Fri, 3 Sep 2021 06:29:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB41B386481A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1630650564; bh=gWb0+2bAGDyEoXtHIzngP2kuiKAqhp4ccwK0dESr6xM=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=bMLDxpRmyyPUvOtK/bQNg0/PZPtbLmqKzcsmVNVIYEu9cKN5GTwyTo4ww7OV/WZ3+ TFlxKLyBk06BtEHJVXZIAmLpWeUzxdlwvSWpXSpUaUmdTNACIYB+oHhdCrDeYbTPRu VXo0+/sDsqeJAihhD8qx9D4DzII2d3va/v9nFj20= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 3C370386102E for ; Fri, 3 Sep 2021 06:29:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3C370386102E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-ffuREpU4No25H_RaF_d_IQ-1; Fri, 03 Sep 2021 02:29:02 -0400 X-MC-Unique: ffuREpU4No25H_RaF_d_IQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29E26501E1; Fri, 3 Sep 2021 06:29:01 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.194.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B47BA5C1C5; Fri, 3 Sep 2021 06:28:59 +0000 (UTC) To: Huang Shijie via Libc-alpha Subject: Re: [PATCH] Add LD_NUMA_REPLICATION for glibc References: <20210903121434.12162-1-shijie@os.amperecomputing.com> Date: Fri, 03 Sep 2021 08:28:57 +0200 In-Reply-To: <20210903121434.12162-1-shijie@os.amperecomputing.com> (Huang Shijie via Libc-alpha's message of "Fri, 3 Sep 2021 12:14:34 +0000") Message-ID: <87bl5a6ul2.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Florian Weimer via Libc-alpha Reply-To: Florian Weimer Cc: Huang Shijie , zwang@amperecomputing.com, patches@amperecomputing.com Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" * 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. The other issue is the temporary RWX mapping, which does not interoperate well with some security hardening features. Thanks, Florian