Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1132848pxb; Wed, 1 Sep 2021 18:33:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnGhO0TP970NSHkX9rA01FfXcQXfwFDYZk2AUwstkIRMV+VwOTEmx+vNoRmRBnfWl8PfnB X-Received: by 2002:a92:194b:: with SMTP id e11mr471016ilm.200.1630546381335; Wed, 01 Sep 2021 18:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630546381; cv=none; d=google.com; s=arc-20160816; b=o80C/mhu7uoxmNKYrHUZLpTd3p8njEEB0AzhZxQulPZEEnOb6SqR7+DH9maclplU4+ oOU90oaVRnn5I6DgG7RJ2Hvh/J5Aqbo8LWykQ2D7W6kozAL1PW4EWpsXoqn9tHI12mZc lzTc6foNXNqRMWwWL4QYEd8Tll1paauRoh73RvMTb37lHImiSK+ie7lr0oecLNeX0aJt l1VWwNpREzIXl+qDHX/rWsuvVOrOn/JybZ4Yc9t/sUbzdsZc195AFZ2SyWlcSqYxWQPH NuAHz7t40Z1EdGMOJckpsBDvQUsNQ6VIk8tBgBY94AN+mFm2h/c5IqUzK3okLWlZVl7r 5CNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NS2CxBpdM7T3fz0/+Dj80k1I+SuLflnA7x6FaBAQ2IE=; b=eW5WfVpNT1+I4xsZjXvcndwOoGqWDW3KnUCHe1UC9FogPNw8OBFTEYEBoN9LT5ekpQ oJSH6xev+cNcahVI7OQiDZ4VQY/lHxwTc0R/DbLWY8JpGp3y+mptFqYNhIOysIG3bV1p AA1l5Op3HCIRxECgi7Zb4Hl+KZva+tXYvq1e0njuyD8NzPAoDoYxa9HfrMPG8w6X1/at U5/dSvUS8R6TtlXM+dCaUuUYLE9BPI9WWg+K+A/6pnPDfdgyB5QjMTVSLcPtwGmRkscj Irf1fM+edoYHw6heWIxSwyw3oyUg4WbUZtX7WQDuL+0Cmo2zgnkA9uiipJgpzI0jPfc9 YHUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=YBL1898A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si324081ioh.72.2021.09.01.18.32.44; Wed, 01 Sep 2021 18:33:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=YBL1898A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238839AbhIBAAd (ORCPT + 99 others); Wed, 1 Sep 2021 20:00:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbhIBAAc (ORCPT ); Wed, 1 Sep 2021 20:00:32 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2A3DC061575 for ; Wed, 1 Sep 2021 16:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NS2CxBpdM7T3fz0/+Dj80k1I+SuLflnA7x6FaBAQ2IE=; b=YBL1898AGSPsCRxznQ0d1JRo8r ZgcAwbgTL4YwbAs7tRU/VZZ+DV6TsoLBRilDMxeqa/i04qHVWKVUPpC7hH/KUvY8tTQdD6bL0WDQ8 UCetGH/beP+vX75Z7Rqm3TlVSnn3W4XCbKfk1245sa5KwQVVrbLlx0W++oPYRWMPj3s1/qhMxchNJ U6G143Xr274AFCP4KwcQRqbk0QTXBKd9NCo4B4oP326BPlYTju9Cse4iCsRGK+0z0ikfRb2VC0rrb 640Mp7v2NBMz3nRYBNoKbz/IDCNeGYIoCxechl4tiTN3/k8L47UlQVWczBK2HQCfE3Y9+78R3aad1 vfD7SuKA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLa7G-002vNq-P4; Wed, 01 Sep 2021 23:58:15 +0000 Date: Thu, 2 Sep 2021 00:58:02 +0100 From: Matthew Wilcox To: Huang Shijie Cc: Shijie Huang , torvalds@linux-foundation.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, linux-mm@kvack.org, song.bao.hua@hisilicon.com, linux-kernel@vger.kernel.org, Frank Wang Subject: Re: Is it possible to implement the per-node page cache for programs/libraries? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 01, 2021 at 02:25:34PM +0000, Huang Shijie wrote: > On Wed, Sep 01, 2021 at 01:30:45PM +0000, Huang Shijie wrote: > > On Wed, Sep 01, 2021 at 04:25:01AM +0100, Matthew Wilcox wrote: > > > On Wed, Sep 01, 2021 at 11:07:41AM +0800, Shijie Huang wrote: > > > > In the NUMA, we only have one page cache for each file. For the > > > > program/shared libraries, the > > > > remote-access delays longer then the local-access. > > > > > > > > So, is it possible to implement the per-node page cache for > > > > programs/libraries? > > > > > > At this point, we have no way to support text replication within a > > > process. So what you're suggesting (if implemented) would work for > > > > I created a glibc patch which can do the text replication within a process. > The "text replication" means the shared libraries, not program itself. Thinking about it some more, if you're ok with it only being shared libraries, you can do this: for i in `seq 0 3`; do \ cp --reflink=always /lib/x86_64-linux-gnu/libc.so.6 \ /lib/x86_64-linux-gnu/libc.so.6.numa$i; \ done Reflinked files don't share page cache, so you can do this all in userspace with no kernel changes.