From owner-svn-src-head@freebsd.org Thu Oct 15 05:58:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 623694334F7; Thu, 15 Oct 2020 05:58:59 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBdrg1zDbz42T1; Thu, 15 Oct 2020 05:58:59 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x544.google.com with SMTP id o3so1192656pgr.11; Wed, 14 Oct 2020 22:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=WYnQFcaw3ap4oZ2A12ERkyA+4Jk8IsjUfTaG53eziEU=; b=sJDkxoz57ADTDVhEg2oDmWlwH89HzfJspi6LyoT6Gs66YWVKYdlriH++SbEPrxUBXT agDbouOynxiriaF8nAyJJ2Us9TBQMmlY5VXexNlpt8VtqNjY/PwToG67ipgjiQmesVjC Ne4y3hHbp5QVpr+xjeeb9yHShcB98BWkYbhQlHvNcgnWfG5w/UBd66CJ7i1zO+aYDjWF nnZWcaeMhPlWPDX8F0Sa10gqBwUzRMLs1v46JuskEFXJVw7ZsI6QZXgDb3tnw23wfkb6 lUkreIK71d1ZANrIK+p13hoH+N6Inv9VVFr2MkWaDIZciBNMfrSe0oWJLydDoC3QHFkt dwsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=WYnQFcaw3ap4oZ2A12ERkyA+4Jk8IsjUfTaG53eziEU=; b=W8gCRWMlAoK+u7Al/Ew0QTIFRI6klUyI9Ak0te6K3BnyMt5R0YHclrrqL7UBmsXcOr XEtDI7h1cwi+uwN4ICPf9oOUQ50FjHGWCyRE/ZGC3O9PA6LRYTVEnu7n1WcgGklBTnmz AVsYdGDduqjnwZ8LhY9vSyaYmsbTHIbbBzwOyAQlQ/y3WEhr0FFPx5+S1eC+1zo09o7L PL3mzRnLMiVC5VOtA4p6tCYgGeFpbZmT7+mZ+pnDvwyHRNsIMkoNdbwuB5+t+t/bEHNi lpNPpobt45TLLI6O3Od0JxsvV4xm76JnSoEorcAYHwMhvgb6NQoEsEc5LxyveEeDTss1 7X6w== X-Gm-Message-State: AOAM532B9K4kS4d6B//L5jQlmWhyRXaFa+6pW9DbcnSIiOlTnnAg0EmP yT9dkk2NmKczpsxGLWd6XD4bpFWc33uygw== X-Google-Smtp-Source: ABdhPJyxpuEgnBdh1DzAqWs/fGKthehC7DFIsCzb66KONSjSyiKQxPFtX7hBW0CiY7dPYG4rF+EMvQ== X-Received: by 2002:a63:1647:: with SMTP id 7mr2066797pgw.446.1602741537577; Wed, 14 Oct 2020 22:58:57 -0700 (PDT) Received: from [192.168.20.26] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id hg15sm1608294pjb.39.2020.10.14.22.58.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2020 22:58:57 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r366697 - head/usr.bin/xinstall From: Enji Cooper In-Reply-To: <202010141228.09ECSg0D023438@repo.freebsd.org> Date: Wed, 14 Oct 2020 22:58:56 -0700 Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <463B3544-BF7B-49FF-82EA-ECB5D8FBB17B@gmail.com> References: <202010141228.09ECSg0D023438@repo.freebsd.org> To: Alex Richardson X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4CBdrg1zDbz42T1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2020 05:58:59 -0000 > On Oct 14, 2020, at 5:28 AM, Alex Richardson = wrote: >=20 > Author: arichardson > Date: Wed Oct 14 12:28:41 2020 > New Revision: 366697 > URL: https://svnweb.freebsd.org/changeset/base/366697 >=20 > Log: > install(1): Avoid unncessary fstatfs() calls and use mmap() based on = size >=20 > According to git blame the trymmap() function was added in 1996 to = skip > mmap() calls for NFS file systems. However, nowadays mmap() should be > perfectly safe even on NFS. Importantly, onl ufs and cd9660 file = systems > were whitelisted so we don't use mmap() on ZFS. It also prevents the = use > of mmap() when bootstrapping from macOS/Linux since on those systems = the > trymmap() function was always returning zero due to the missing = MFSNAMELEN > define. >=20 > This change keeps the trymmap() function but changes it to check = whether > using mmap() can reduce the number of system calls that are required. > Using mmap() only reduces the number of system calls if we need = multiple read() > syscalls, i.e. if the file size is > MAXBSIZE. However, mmap() is = more expensive > than read() so this sets the threshold at 4 fewer syscalls. = Additionally, for > larger file size mmap() can significantly increase the number of page = faults, > so avoid it in that case. >=20 > It's unclear whether using mmap() is ever faster than a read with an = appropriate > buffer size, but this change at least removes two unnecessary system = calls > for every file that is installed. >=20 > Reviewed By: markj > Differential Revision: https://reviews.freebsd.org/D26041 * Has this change been tested out with source filesystems other = than UFS/ZFS? Not all filesystems support mmap(2). * trymmap(..) seems to be less about computing whether or not = the filesystem should use mmap(2) after this change, but how it should = use mmap(2). Seems like a misnamed function call now. Cheers, -Enji=