From owner-svn-src-all@freebsd.org Thu Dec 5 03:38:15 2019 Return-Path: Delivered-To: svn-src-all@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 05D251B8940; Thu, 5 Dec 2019 03:38:15 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47T1dd5Nlpz3CdQ; Thu, 5 Dec 2019 03:38:13 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pg1-x541.google.com with SMTP id b137so904592pga.6; Wed, 04 Dec 2019 19:38:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dxii9tXW6AQrSxEOigx+Jjx8Z6ta9s2etl3GC4DCEIQ=; b=hEjaQbXQiITDLqaJEbFm1Ki937pS16haZiLB9z4b9ikEiXUJU5i/AqMvtiZrizEC9L yV4aLYxEjBSENIEHoP9ZH6/8si+WPchavraiRWXssWkUG1pwLZzwEZ78xx/ylUZDv/FK aA9n3Ov3dk7QiMmg8qDGcaYQHTQ2cCyLNI9bfx3Y5hCwwEDdK9D9YHWW/3GMViCYAPqY FsmXoIxLbW3CYp2q60FlFpn2Ksujgf0Kyd2MKFdpiHAyhzuMFDy3cnDpe2SIotxUORCk Bq2bo9fopckSdR7teySRPv1oL9w53pXDH5lxUD5za9gMx4l3JPb1UUuObvDdjkEtaUuG k5Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=dxii9tXW6AQrSxEOigx+Jjx8Z6ta9s2etl3GC4DCEIQ=; b=RF89zIDmaUrIx+4IJYA5KWLCjNxLmIuhCMSlec1CJ3gcMitSVIo/43WJYI7/0nvuzq iIC02yshDo/owSWH4yglEiIu4W+FbrO5DdoaYzyaz8cUQos+nKpbI3Vol3SJj9Hr2I8h PoR66exd75n+TUg4kPRkQeUy8u7btEVV6WAqjUPD33DbFxsNkxKhPzOafk/IMhu3NvLR KU3h6QkXOzGDved/u4i0sWxt3Mx948suoYI3L3mwUDzaQyPmjdZVtFfYPKx5nN+oqMCt o/abqteJFvge9i5VfXbu9RllkbVG+cOJ+27eUus4qy5gt7X0cf+wfshoommQqifRCkSh OJtg== X-Gm-Message-State: APjAAAUhQ+ruGexT97fF7siqeELSb0HOhKC9Tm+aUF6ZLLeD3D3w63LT czd3eFEN2FI2ak1ipjVxbdvKh/8q X-Google-Smtp-Source: APXvYqy1POYLQ4JlBBXSadh9UNAtfqQdrS1u3lEn92Z4CnWYj8HfC7sXIkBCQmqWAJwtEIaiXewB9w== X-Received: by 2002:a63:1402:: with SMTP id u2mr7062134pgl.224.1575517091456; Wed, 04 Dec 2019 19:38:11 -0800 (PST) Received: from [192.168.1.110] (180-150-68-130.b49644.syd.nbn.aussiebb.net. [180.150.68.130]) by smtp.gmail.com with ESMTPSA id d38sm8759818pgd.59.2019.12.04.19.38.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Dec 2019 19:38:10 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r355407 - head/sys/fs/tmpfs To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912050003.xB503HtP008634@repo.freebsd.org> From: Kubilay Kocak Message-ID: Date: Thu, 5 Dec 2019 14:38:07 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Thunderbird/71.0 MIME-Version: 1.0 In-Reply-To: <201912050003.xB503HtP008634@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47T1dd5Nlpz3CdQ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=hEjaQbXQ; dmarc=none; spf=pass (mx1.freebsd.org: domain of koobsfreebsd@gmail.com designates 2607:f8b0:4864:20::541 as permitted sender) smtp.mailfrom=koobsfreebsd@gmail.com X-Spamd-Result: default: False [-3.20 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[koobs@FreeBSD.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; FORGED_SENDER(0.30)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; IP_SCORE(-1.00)[ip: (-0.76), ipnet: 2607:f8b0::/32(-2.23), asn: 15169(-1.93), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_NEQ_ENVFROM(0.00)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_IN_DNSWL_NONE(0.00)[1.4.5.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]; RCVD_TLS_ALL(0.00)[] 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: Thu, 05 Dec 2019 03:38:15 -0000 On 5/12/2019 11:03 am, Konstantin Belousov wrote: > Author: kib > Date: Thu Dec 5 00:03:17 2019 > New Revision: 355407 > URL: https://svnweb.freebsd.org/changeset/base/355407 Could you elaborate on the why/rationale? Is there memory wastage/duplication, bug(s), performance or development/maintenance benefit? The review summary doesnt appear to include this information either > Log: > Stop using per-mount tmpfs zones. > > Requested and reviewed by: jeff > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D22643 > > Modified: > head/sys/fs/tmpfs/tmpfs.h > head/sys/fs/tmpfs/tmpfs_subr.c > head/sys/fs/tmpfs/tmpfs_vfsops.c > > Modified: head/sys/fs/tmpfs/tmpfs.h > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs.h Wed Dec 4 23:24:40 2019 (r355406) > +++ head/sys/fs/tmpfs/tmpfs.h Thu Dec 5 00:03:17 2019 (r355407) > @@ -378,10 +378,6 @@ struct tmpfs_mount { > /* All node lock to protect the node list and tmp_pages_used. */ > struct mtx tm_allnode_lock; > > - /* Zones used to store file system meta data, per tmpfs mount. */ > - uma_zone_t tm_dirent_pool; > - uma_zone_t tm_node_pool; > - > /* Read-only status. */ > bool tm_ronly; > /* Do not use namecache. */ > @@ -493,8 +489,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node > #endif > > size_t tmpfs_mem_avail(void); > - > size_t tmpfs_pages_used(struct tmpfs_mount *tmp); > +void tmpfs_subr_init(void); > +void tmpfs_subr_uninit(void); > > #endif > > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs_subr.c Wed Dec 4 23:24:40 2019 (r355406) > +++ head/sys/fs/tmpfs/tmpfs_subr.c Thu Dec 5 00:03:17 2019 (r355407) > @@ -72,7 +72,74 @@ SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmp > > static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; > > +static uma_zone_t tmpfs_dirent_pool; > +static uma_zone_t tmpfs_node_pool; > + > static int > +tmpfs_node_ctor(void *mem, int size, void *arg, int flags) > +{ > + struct tmpfs_node *node; > + > + node = mem; > + node->tn_gen++; > + node->tn_size = 0; > + node->tn_status = 0; > + node->tn_flags = 0; > + node->tn_links = 0; > + node->tn_vnode = NULL; > + node->tn_vpstate = 0; > + return (0); > +} > + > +static void > +tmpfs_node_dtor(void *mem, int size, void *arg) > +{ > + struct tmpfs_node *node; > + > + node = mem; > + node->tn_type = VNON; > +} > + > +static int > +tmpfs_node_init(void *mem, int size, int flags) > +{ > + struct tmpfs_node *node; > + > + node = mem; > + node->tn_id = 0; > + mtx_init(&node->tn_interlock, "tmpfsni", NULL, MTX_DEF); > + node->tn_gen = arc4random(); > + return (0); > +} > + > +static void > +tmpfs_node_fini(void *mem, int size) > +{ > + struct tmpfs_node *node; > + > + node = mem; > + mtx_destroy(&node->tn_interlock); > +} > + > +void > +tmpfs_subr_init(void) > +{ > + tmpfs_dirent_pool = uma_zcreate("TMPFS dirent", > + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, > + UMA_ALIGN_PTR, 0); > + tmpfs_node_pool = uma_zcreate("TMPFS node", > + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, > + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); > +} > + > +void > +tmpfs_subr_uninit(void) > +{ > + uma_zdestroy(tmpfs_node_pool); > + uma_zdestroy(tmpfs_dirent_pool); > +} > + > +static int > sysctl_mem_reserved(SYSCTL_HANDLER_ARGS) > { > int error; > @@ -219,8 +286,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount > if ((mp->mnt_kern_flag & MNT_RDONLY) != 0) > return (EROFS); > > - nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, > - M_WAITOK); > + nnode = uma_zalloc_arg(tmpfs_node_pool, tmp, M_WAITOK); > > /* Generic initialization. */ > nnode->tn_type = type; > @@ -367,7 +433,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct > panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); > } > > - uma_zfree(tmp->tm_node_pool, node); > + uma_zfree(tmpfs_node_pool, node); > TMPFS_LOCK(tmp); > tmpfs_free_tmp(tmp); > return (true); > @@ -434,7 +500,7 @@ tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmp > { > struct tmpfs_dirent *nde; > > - nde = uma_zalloc(tmp->tm_dirent_pool, M_WAITOK); > + nde = uma_zalloc(tmpfs_dirent_pool, M_WAITOK); > nde->td_node = node; > if (name != NULL) { > nde->ud.td_name = malloc(len, M_TMPFSNAME, M_WAITOK); > @@ -470,7 +536,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpf > } > if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) > free(de->ud.td_name, M_TMPFSNAME); > - uma_zfree(tmp->tm_dirent_pool, de); > + uma_zfree(tmpfs_dirent_pool, de); > } > > void > > Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs_vfsops.c Wed Dec 4 23:24:40 2019 (r355406) > +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Thu Dec 5 00:03:17 2019 (r355407) > @@ -99,49 +99,6 @@ static const char *tmpfs_updateopts[] = { > "from", "export", "size", NULL > }; > > -static int > -tmpfs_node_ctor(void *mem, int size, void *arg, int flags) > -{ > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > - > - node->tn_gen++; > - node->tn_size = 0; > - node->tn_status = 0; > - node->tn_flags = 0; > - node->tn_links = 0; > - node->tn_vnode = NULL; > - node->tn_vpstate = 0; > - > - return (0); > -} > - > -static void > -tmpfs_node_dtor(void *mem, int size, void *arg) > -{ > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > - node->tn_type = VNON; > -} > - > -static int > -tmpfs_node_init(void *mem, int size, int flags) > -{ > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > - node->tn_id = 0; > - > - mtx_init(&node->tn_interlock, "tmpfs node interlock", NULL, MTX_DEF); > - node->tn_gen = arc4random(); > - > - return (0); > -} > - > -static void > -tmpfs_node_fini(void *mem, int size) > -{ > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > - > - mtx_destroy(&node->tn_interlock); > -} > - > /* > * Handle updates of time from writes to mmaped regions. Use > * MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_ACTIVE, since > @@ -481,12 +438,6 @@ tmpfs_mount(struct mount *mp) > tmp->tm_pages_max = pages; > tmp->tm_pages_used = 0; > new_unrhdr64(&tmp->tm_ino_unr, 2); > - tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", > - sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, > - UMA_ALIGN_PTR, 0); > - tmp->tm_node_pool = uma_zcreate("TMPFS node", > - sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, > - tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); > tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; > tmp->tm_nonc = nonc; > > @@ -495,8 +446,6 @@ tmpfs_mount(struct mount *mp) > root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); > > if (error != 0 || root == NULL) { > - uma_zdestroy(tmp->tm_node_pool); > - uma_zdestroy(tmp->tm_dirent_pool); > free(tmp, M_TMPFSMNT); > return (error); > } > @@ -590,9 +539,6 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp) > } > TMPFS_UNLOCK(tmp); > > - uma_zdestroy(tmp->tm_dirent_pool); > - uma_zdestroy(tmp->tm_node_pool); > - > mtx_destroy(&tmp->tm_allnode_lock); > MPASS(tmp->tm_pages_used == 0); > MPASS(tmp->tm_nodes_inuse == 0); > @@ -702,10 +648,23 @@ tmpfs_susp_clean(struct mount *mp __unused) > { > } > > +static int > +tmpfs_init(struct vfsconf *conf) > +{ > + tmpfs_subr_init(); > + return (0); > +} > + > +static int > +tmpfs_uninit(struct vfsconf *conf) > +{ > + tmpfs_subr_uninit(); > + return (0); > +} > + > /* > * tmpfs vfs operations. > */ > - > struct vfsops tmpfs_vfsops = { > .vfs_mount = tmpfs_mount, > .vfs_unmount = tmpfs_unmount, > @@ -715,5 +674,7 @@ struct vfsops tmpfs_vfsops = { > .vfs_fhtovp = tmpfs_fhtovp, > .vfs_sync = tmpfs_sync, > .vfs_susp_clean = tmpfs_susp_clean, > + .vfs_init = tmpfs_init, > + .vfs_uninit = tmpfs_uninit, > }; > VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >