From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47084 invoked by alias); 10 Nov 2016 07:39:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 47072 invoked by uid 89); 10 Nov 2016 07:39:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:1554, adjusting, tricks, H*r:10.10.10 X-HELO: mail-wm0-f51.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=lmxls/8zANOMIn900mdIl6mbxXG2mClo/AzgHKR6Mcc=; b=B9/NdzBiKvbupku9BFb/czt35OuRmmih5vcVlvzLApvXYyGpBLc5+ndP5hBBnMW14m Z5OgCc+6u+tBHb+ppkYP0n4Cmli0ExreWR3BeGdIAsmrIDuT/fMMvGP7tfBPacPDgc7M Tfo3twOoo2Ukp4YU48w8Wq/W3NhowAbq7bSINphEBeYEWyvRt/AoJjm770wAJpkbtr0V ZoU11tOZcSJ8MbduFqYrw88OXeK/BK2RIS5JI2nhEDv4yMJ/BA4LlHKE3rzepfGKl5Bp ds/p2MubtpZohVO0Jp68ChSmMB4qzEWCkZoKXDKso6p+uf9li6715MoHPmVcVaqiReQl DAdg== X-Gm-Message-State: ABUngvebAg+lIeeLVsqfk0rbNTSVnuWfYCI3SgpmvEpWb0yjEJeMy0q43KKWoDRcpAe2OjFS X-Received: by 10.28.68.131 with SMTP id r125mr23368748wma.28.1478763580128; Wed, 09 Nov 2016 23:39:40 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: [libc/string] State of PAGE_COPY_FWD / PAGE_COPY_THRESHOLD From: Maxim Kuvyrkov In-Reply-To: Date: Thu, 10 Nov 2016 07:39:00 -0000 Cc: libc-alpha@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: <193512EC-DC6C-4BDF-8138-1C1F54B30A12@linaro.org> References: To: Adhemerval Zanella X-SW-Source: 2016-11/txt/msg00374.txt.bz2 > On Nov 1, 2016, at 5:59 PM, Adhemerval Zanella wrote: >=20 ... > $ cat sysdeps/x86/pagecopy.h >=20 > #define PAGE_SIZE 4096 > #define PAGE_COPY_THRESHOLD PAGE_SIZE >=20 > #define PAGE_COPY_FWD(dstp, srcp, nbytes_left, nbytes) /* Implement it */ >=20 > It should work on any other architecture as well. Now the question > is whether this actually does make sense for Linux. Hurd/mach provided > a syscall (?) to actually copy the pages (vm_copy) which seems to apply > some tricks to avoid full copy pages. By 'linux zero page sharing' are=20 > you referring to KSM (Kernel Samepage Merging)?=20 >=20 > If so, on a system without a provided kernel interface to work directed=20 > with underlying memory mapping (such as for mach), mem{cpy,set} will=20 > actually need to touch the pages and it will be up to kernel page fault=20 > mechanism to actually handle it (by identifying common pages and adjusting > vma mapping accordingly). And AFAIK this are only enabled on KSM if you=20 > actually madavise the page explicit. So I am not grasping the need to > actually implement page copying on Linux. Linux kernel has a reserved page filled with zeroes, so it there /were/ a s= yscall to tell kernel to map N consecutive pages starting at address PTR to= that zero page, we could use that in GLIBC for really big memset(0). A quick investigation shows that there is no such syscall provided by the L= inux kernel. Doesn't mean we can't ask for / implement one. -- Maxim Kuvyrkov www.linaro.org