From owner-dev-commits-src-main@freebsd.org Sat Jan 23 20:22:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BC2064DD2C8; Sat, 23 Jan 2021 20:22:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 4DNSGZ3Fqrz4tv7; Sat, 23 Jan 2021 20:22:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x433.google.com with SMTP id a1so8409345wrq.6; Sat, 23 Jan 2021 12:22:14 -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=7crC98+hqVezOnNSUZB6SrvASDknqcFDpWG49hpAhBM=; b=Utd0pG+znqmhRpls0Zo9rqu1TpRzSK+99zkxduP1RUi0MpZ0kaRcswydCNWQnSpu2L LF2Q3Zn6h6wIu7NNNcv80Jqtgi5JsI6Ox461WLNv8nd7W2bDlFhd7bDsyktN8mygsvQM ZXoCiwn6t60562VSJ8HEUykmcxctyKehEzWMmYi0OcdDz7YuljWPcOv3VC5e/RD0Bq/0 arik1Eto+4LAJYZLAcUZ+fLRsMQvxZTHeAeJMnChxnAJg/oTXGM6Ecp8wSSqjSUXYh2v ZZRRBvii8N7idm8WdQ96pDYqPvBNO5jBjdu1/DLsnVHITnNPyVJHFIwJ/tDPotn0weh+ ENDA== 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=7crC98+hqVezOnNSUZB6SrvASDknqcFDpWG49hpAhBM=; b=KSwJw76qvQOXl7En1DyzVeatei1Qyty/wIdDqSCQyKWuQsDAxhuETMHb25ZdNXu0uU tG4mEdxn4rE6WVGbGdMZ+UHodSzHsiLco2FIWRJNHSlbIopeb5f7qNI+fzqPG4oYX0kt FP+8O7/WnQpDb+nIfCftZCXrgjB2p+/z+3jgieLecj8miWrG18AffQqBtZ7R4IYBlf9N VTYBUJavPDolgnGd3yOxZH7LieZh6V8gf0J4EuEMPAOOKi70AwtI4l/z6jZXWGc7v2Im C9ZOeE8Q8hbxFFTVuqJ37DzUaxI+fk8H2uRzUjCXGu7TI9ZqiPSo/3Dn/ACF3hU20TT/ Prsw== X-Gm-Message-State: AOAM532fhcRfoMtUU9nTo+5dUHR4EqWAXbdyDQoMTSedEa9a8k4eOZR3 mKwiTBgWb4Z3qDMjDv6QDx266hM+aBqAdjCqMGMzqSLmYQ4= X-Google-Smtp-Source: ABdhPJyUJ3rTRI5x73LhBG0L/Wldsabe4AqN4V9Sb1urHqA/lRDqupY1zW1WHgHYn/UNnt/L1C/UHR2N1FoL3z52Lzs= X-Received: by 2002:a5d:4e92:: with SMTP id e18mr186960wru.66.1611433333226; Sat, 23 Jan 2021 12:22:13 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Sat, 23 Jan 2021 12:22:12 -0800 (PST) In-Reply-To: References: <202101231810.10NIAKXd018767@gitrepo.freebsd.org> From: Mateusz Guzik Date: Sat, 23 Jan 2021 21:22:12 +0100 Message-ID: Subject: Re: git: 02ec31bdf60f - main - cache: add back target entry on rename To: Oliver Pinter Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DNSGZ3Fqrz4tv7 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Utd0pG+z; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::433 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.73 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.73)[-0.733]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::433:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::433:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::433:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 20:22:15 -0000 The sysctl at hand is temporary in case someone reports trouble -- then they can flip it. I don't expect it to survive more than a month. On 1/23/21, Oliver Pinter wrote: > On Saturday, January 23, 2021, Mateusz Guzik wrote: > >> The branch main has been updated by mjg: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id= >> 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d >> >> commit 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d >> Author: Mateusz Guzik >> AuthorDate: 2021-01-23 17:21:42 +0000 >> Commit: Mateusz Guzik >> CommitDate: 2021-01-23 18:10:16 +0000 >> >> cache: add back target entry on rename >> --- >> sys/kern/vfs_cache.c | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c >> index 770c8ebf061b..03bafc75acaa 100644 >> --- a/sys/kern/vfs_cache.c >> +++ b/sys/kern/vfs_cache.c >> @@ -367,6 +367,10 @@ static bool __read_frequently cache_fast_revlookup = >> true; >> SYSCTL_BOOL(_vfs, OID_AUTO, cache_fast_revlookup, CTLFLAG_RW, >> &cache_fast_revlookup, 0, ""); >> >> +static bool __read_mostly cache_rename_add = true; >> +SYSCTL_BOOL(_vfs, OID_AUTO, cache_rename_add, CTLFLAG_RW, >> + &cache_rename_add, 0, ""); > > > It would be really if the description were filled with proper info. > > + >> static u_int __exclusive_cache_line neg_cycle; >> >> #define ncneghash 3 >> @@ -2731,6 +2735,21 @@ cache_vop_rename(struct vnode *fdvp, struct vnode >> *fvp, struct vnode *tdvp, >> } else { >> cache_remove_cnp(tdvp, tcnp); >> } >> + >> + /* >> + * TODO >> + * >> + * Historically renaming was always purging all revelang entries, >> + * but that's quite wasteful. In particular turns out that in >> many >> cases >> + * the target file is immediately accessed after rename, inducing >> a cache >> + * miss. >> + * >> + * Recode this to reduce relocking and reuse the existing entry >> (if any) >> + * instead of just removing it above and allocating a new one >> here. >> + */ >> + if (cache_rename_add) { >> + cache_enter(tdvp, fvp, tcnp); >> + } >> } >> >> void >> _______________________________________________ >> dev-commits-src-all@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all >> To unsubscribe, send any mail to "dev-commits-src-all- >> unsubscribe@freebsd.org" >> > -- Mateusz Guzik