From owner-svn-src-all@freebsd.org Sat Dec 8 03:49:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60074132EE0B; Sat, 8 Dec 2018 03:49:49 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9816B1DC; Sat, 8 Dec 2018 03:49:48 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt1-x832.google.com with SMTP id z16so6815393qtq.4; Fri, 07 Dec 2018 19:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Q9f2Qw0tLvGo9botAjw5W/kxZfM8QuT05KDr/MNEyXg=; b=VanJwnkZJWECfjiCui9ppJrk1Fmn2heBHpRuW6k4j4gL17xQNTl9CIqFelDCcdAIw4 4Xill7vzOx/GwSiaUYykt9CuANc7eTzS1tabJ4EaxH1XS2oPeURO0bwO9w+qnFIDP1MI 7C1nOjkvtAkYcq4A6M/9uvjEvKCIoHPzHJ+WJ33nsZbsLmI1hsNHEI2Cupv9s9u+1WOe hSq+JwcFhuTTt7+pxbRDER4n52+/NiHNDdksP5R259VBt9Ea+qydiyb5+eGh8GnsY95a VfirLtlN04d5/H93eASmbzvJMcP/2hQmIzBKivE2uBtIcWiGGlHrs8tWMfMCNLFbOuCG X0lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Q9f2Qw0tLvGo9botAjw5W/kxZfM8QuT05KDr/MNEyXg=; b=Fj3eUXMFS/nURG1z5aoFWpE+ePZYYpGXMouKDD0bf3EFDWQTNr21UN9TrqeJtuYPiz uqVjrPQgElZbFwT9b9mrCz87KsjFWRFa5HltkKzVRMUrrbz4EipkqM2lmVD1xMVSaUG+ 7tykG/PBNyUz65/VjvrRByEwlbdjQw8RG+6j/LepJGrVxiUkh7bFpVy1xG6fwUZ0CVGb DWm2x3aTCCdKLfUxzG0TKgw71Ixu4OpVJnbcS0s7HQT9kl7LGB+y7ILXyW/Mjs49Z4Rt NCeSLKu/4OK7guvwrFFKhdtg4QjH0KiPR0rhQxQHdwrusPPDdS9TQgXfRMkkgZ8Vtbsu dBgg== X-Gm-Message-State: AA+aEWZj2KO21MNplMExtE5UCEpYruV7iQ2/lwzXnDOwgPyja/lwidLS MUC7Fp4Q3NXxdy5NABdjg6XeMWYL9dVXxN+2OC/kZw== X-Google-Smtp-Source: AFSGD/VSN+EP+B3GBbtQeKNJtHPGp/aqPW2W3yoiHxV1CCUIo+7Kr4EDFbvoeGq0oUni9A6zp+TPuIYDBF43whI05Sg= X-Received: by 2002:ac8:46c6:: with SMTP id h6mr4503133qto.315.1544240987985; Fri, 07 Dec 2018 19:49:47 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ac8:784:0:0:0:0:0 with HTTP; Fri, 7 Dec 2018 19:49:47 -0800 (PST) In-Reply-To: <1544206201.1860.288.camel@freebsd.org> References: <201812071205.wB7C5BvA038350@repo.freebsd.org> <1544206201.1860.288.camel@freebsd.org> From: Mateusz Guzik Date: Sat, 8 Dec 2018 04:49:47 +0100 Message-ID: Subject: Re: svn commit: r341682 - head/sys/sys To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 9E9816B1DC X-Spamd-Result: default: False [-5.58 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.52)[-0.516,0]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; IP_SCORE(-2.05)[ip: (-7.36), ipnet: 2607:f8b0::/32(-1.50), asn: 15169(-1.30), country: US(-0.09)] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 03:49:49 -0000 On 12/7/18, Ian Lepore wrote: > On Fri, 2018-12-07 at 12:05 +0000, Mateusz Guzik wrote: >> Author: mjg >> Date: Fri Dec 7 12:05:11 2018 >> New Revision: 341682 >> URL: https://svnweb.freebsd.org/changeset/base/341682 >> >> Log: >> unr64: use locked variant if not __LP64__ >> >> The current ifdefs are not sufficient to distinguish 32- and 64- >> bit >> variants, which results e.g. in powerpc64 not using atomics. >> >> While some 32-bit archs provide 64-bit atomics, there is no huge >> advantage >> of using them on these platforms. >> [..] > This seems like a wholly unsatisfying solution compared to how trivial > it would be to do something like have each arch's atomic.h set a symbol > to indicate whether 64-bit atomics are available. Dismissing 32-bit > arches because you don't perceive performance to be important there > doesn't seem like a valid argument. > But performance *is* improved on 32-bit architectures as well. Bitmap handling would try to very hard to reduce memory usage, which had a lot of single-threaded overhead (e.g. it allocates memory just in case and then frees it). Since 64-bit inode numbers can simply grow there is no need for any of it and memory use is 64 bit to store the variable. And that's what unr64 is doing. The main difference here is in scalability - taking a lock, bumping a variable and releasing the lock scales much worse than an atomic (which still scales poorly if heavily used). 32-bit arches don't really have enough concurrency to see a difference with this code. single-threaded this is indeed a little bit slower, but this is not running in any hot path. Fully satisfying solution would be that all architectures get 64-bit ops, even if in the worst case they end up taking a lock. Then subsystems would not have to ifdef on anything. However, there was some opposition to this proposal and I don't think this is important enough to push. -- Mateusz Guzik