The NetBSD Project

CVS log for src/sys/kern/vfs_cwd.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / kern

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.12: download - view: text, markup, annotated - select for diffs
Sat Dec 7 02:11:42 2024 UTC (4 days, 4 hours ago) by riastradh
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +5 -4 lines
vfs(9): Sprinkle KNF.

No functional change intended.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sat Sep 23 18:21:11 2023 UTC (14 months, 2 weeks ago) by ad
Branches: MAIN
CVS tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation, perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +11 -38 lines
Repply this change with a couple of bugs fixed:

- Do away with separate pool_cache for some kernel objects that have no special
  requirements and use the general purpose allocator instead. On one of my
  test systems this makes for a small (~1%) but repeatable reduction in system
  time during builds presumably because it decreases the kernel's cache /
  memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Tue Sep 12 16:17:21 2023 UTC (14 months, 4 weeks ago) by ad
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +38 -11 lines
Back out recent change to replace pool_cache with then general allocator.
Will return to this when I have time again.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sun Sep 10 14:45:52 2023 UTC (15 months ago) by ad
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +11 -38 lines
- Do away with separate pool_cache for some kernel objects that have no special
  requirements and use the general purpose allocator instead.  On one of my
  test systems this makes for a small (~1%) but repeatable reduction in system
  time during builds presumably because it decreases the kernel's cache /
  memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sat Apr 9 23:38:33 2022 UTC (2 years, 8 months ago) by riastradh
Branches: MAIN
CVS tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +4 -4 lines
sys: Use membar_release/acquire around reference drop.

This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat Mar 12 15:32:32 2022 UTC (2 years, 9 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +4 -2 lines
sys: Membar audit around reference count releases.

If two threads are using an object that is freed when the reference
count goes to zero, we need to ensure that all memory operations
related to the object happen before freeing the object.

Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one
thread takes responsibility for freeing, but it's not enough to
ensure that the other thread's memory operations happen before the
freeing.

Consider:

	  Thread A			  Thread B
	obj->foo = 42;			obj->baz = 73;
	mumble(&obj->bar);		grumble(&obj->quux);
	/* membar_exit(); */		/* membar_exit(); */
	atomic_dec -- not last		atomic_dec -- last
					/* membar_enter(); */
					KASSERT(invariant(obj->foo,
					    obj->bar));
					free_stuff(obj);

The memory barriers ensure that

	obj->foo = 42;
	mumble(&obj->bar);

in thread A happens before

	KASSERT(invariant(obj->foo, obj->bar));
	free_stuff(obj);

in thread B.  Without them, this ordering is not guaranteed.

So in general it is necessary to do

	membar_exit();
	if (atomic_dec_uint_nv(&obj->refcnt) != 0)
		return;
	membar_enter();

to release a reference, for the `last one out hit the lights' style
of reference counting.  (This is in contrast to the style where one
thread blocks new references and then waits under a lock for existing
ones to drain with a condvar -- no membar needed thanks to mutex(9).)

I searched for atomic_dec to find all these.  Obviously we ought to
have a better abstraction for this because there's so much copypasta.
This is a stop-gap measure to fix actual bugs until we have that.  It
would be nice if an abstraction could gracefully handle the different
styles of reference counting in use -- some years ago I drafted an
API for this, but making it cover everything got a little out of hand
(particularly with struct vnode::v_usecount) and I ended up setting
it aside to work on psref/localcount instead for better scalability.

I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I
only put it on things that look performance-critical on 5sec review.
We should really adopt membar_enter_preatomic/membar_exit_postatomic
or something (except they are applicable only to atomic r/m/w, not to
atomic_load/store_*, making the naming annoying) and get rid of all
the ifdefs.

Revision 1.5.4.1: download - view: text, markup, annotated - select for diffs
Sat Apr 25 11:24:06 2020 UTC (4 years, 7 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.5: preferred, colored; next MAIN 1.6: preferred, colored
Changes since revision 1.5: +7 -124 lines
Sync with bouyer-xenpvh-base2 (HEAD)

Revision 1.6: download - view: text, markup, annotated - select for diffs
Tue Apr 21 21:42:47 2020 UTC (4 years, 7 months ago) by ad
Branches: MAIN
CVS tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-futex, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-xenpvh-base2
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +7 -124 lines
Revert the changes made in February to make cwdinfo use mostly lockless,
which relied on taking extra vnode refs.

Having benchmarked various experimental changes over the past few months it
seems that it's better to avoid vnode refs as much as possible.  cwdi_lock
as a RW lock already did that to some extent for getcwd() and will permit
the same for namei() too.

Revision 1.4.56.1: download - view: text, markup, annotated - select for diffs
Wed Apr 8 14:08:52 2020 UTC (4 years, 8 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4: +125 -8 lines
Merge changes from current as of 20200406

Revision 1.4.62.3: download - view: text, markup, annotated - select for diffs
Sat Feb 29 20:21:03 2020 UTC (4 years, 9 months ago) by ad
Branches: ad-namecache
Diff to: previous 1.4.62.2: preferred, colored; branchpoint 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4.62.2: +3 -5 lines
Sync with head.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sun Feb 23 22:14:03 2020 UTC (4 years, 9 months ago) by ad
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp, bouyer-xenpvh-base1, bouyer-xenpvh-base, ad-namecache-base3
Branch point for: bouyer-xenpvh
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +125 -8 lines
Merge from ad-namecache:

- Have a stab at clustering the members of vnode_t and vnode_impl_t in a
  more cache-conscious way.  With that done, go back to adjusting v_usecount
  with atomics and keep vi_lock directly in vnode_impl_t (saves KVA).

- Allow VOP_LOCK(LK_NONE) for the benefit of VFS_VGET() and VFS_ROOT().
  Make sure LK_UPGRADE always comes with LK_NOWAIT.

- Make cwdinfo use mostly lockless.

Revision 1.4.62.2: download - view: text, markup, annotated - select for diffs
Sat Jan 25 18:42:24 2020 UTC (4 years, 10 months ago) by ad
Branches: ad-namecache
Diff to: previous 1.4.62.1: preferred, colored; branchpoint 1.4: preferred, colored
Changes since revision 1.4.62.1: +5 -3 lines
Add a missing membar to previous.

Revision 1.4.62.1: download - view: text, markup, annotated - select for diffs
Sat Jan 25 15:54:03 2020 UTC (4 years, 10 months ago) by ad
Branches: ad-namecache
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +125 -8 lines
Make cwdinfo use mostly lockless, and largely hide the details in vfs_cwd.c.

Revision 1.3.6.1: download - view: text, markup, annotated - select for diffs
Mon Jun 6 09:09:40 2011 UTC (13 years, 6 months ago) by jruoho
Branches: jruoho-x86intr
Diff to: previous 1.3: preferred, colored; next MAIN 1.4: preferred, colored
Changes since revision 1.3: +13 -2 lines
Sync with HEAD.

Revision 1.3.4.1: download - view: text, markup, annotated - select for diffs
Sat Mar 5 20:55:25 2011 UTC (13 years, 9 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.3: preferred, colored; next MAIN 1.4: preferred, colored
Changes since revision 1.3: +13 -2 lines
sync with head

Revision 1.3.8.1: download - view: text, markup, annotated - select for diffs
Thu Feb 17 12:00:44 2011 UTC (13 years, 9 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.3: preferred, colored; next MAIN 1.4: preferred, colored
Changes since revision 1.3: +13 -2 lines
Sync with HEAD

Revision 1.4: download - view: text, markup, annotated - select for diffs
Tue Feb 15 15:54:28 2011 UTC (13 years, 9 months ago) by pooka
Branches: MAIN
CVS tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base-20171202, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, rmind-uvmplock-nbase, rmind-uvmplock-base, rmind-smpnet-nbase, rmind-smpnet-base, rmind-smpnet, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20191119, phil-wifi-20190609, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base, nick-nhusb, netbsd-9-base, netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-3-RELEASE, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb8-mediatek-base, matt-nb8-mediatek, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, localcount-20160914, khorben-n900, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base10, jmcneill-usbmp-base, jmcneill-usbmp, jmcneill-audiomp3-base, jmcneill-audiomp3, jdolecek-ncq-base, jdolecek-ncq, isaki-audio2-base, isaki-audio2, cherry-xenmp-base, cherry-xenmp, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, bouyer-quota2-nbase, bouyer-quota2-base, agc-symver-base, agc-symver, ad-namecache-base2, ad-namecache-base1, ad-namecache-base
Branch point for: phil-wifi, ad-namecache
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +13 -2 lines
Support FD_CLOEXEC in rump kernels.

Revision 1.1.12.3: download - view: text, markup, annotated - select for diffs
Thu Mar 11 15:04:20 2010 UTC (14 years, 9 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.1.12.2: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.12.2: +6 -6 lines
sync with head

Revision 1.3: download - view: text, markup, annotated - select for diffs
Fri Jan 8 11:35:10 2010 UTC (14 years, 11 months ago) by pooka
Branches: MAIN
CVS tags: yamt-nfs-mp-base9, yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, uebayasi-xip-base1, uebayasi-xip-base, uebayasi-xip, matt-mips64-premerge-20101231, jruoho-x86intr-base
Branch point for: rmind-uvmplock, jruoho-x86intr, bouyer-quota2
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +5 -5 lines
The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase).  Plenty of mix'n match upper/lowercase has creeped
into the tree since then.  Nuke the macros and convert all callsites
to lowercase.

no functional change

Revision 1.2: download - view: text, markup, annotated - select for diffs
Thu Sep 24 06:14:22 2009 UTC (15 years, 2 months ago) by yamt
Branches: MAIN
CVS tags: matt-premerge-20091211, jym-xensuspend-nbase
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +3 -3 lines
cwdinit: whitespace fix.  no functional changes.

Revision 1.1.12.2: download - view: text, markup, annotated - select for diffs
Mon May 4 08:13:49 2009 UTC (15 years, 7 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.1.12.1: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.12.1: +150 -0 lines
sync with head.

Revision 1.1.8.2: download - view: text, markup, annotated - select for diffs
Mon Jan 19 13:19:40 2009 UTC (15 years, 10 months ago) by skrll
Branches: nick-hppapmap
Diff to: previous 1.1.8.1: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.8.1: +150 -0 lines
Sync with HEAD.

Revision 1.1.6.2: download - view: text, markup, annotated - select for diffs
Sat Jan 17 13:29:20 2009 UTC (15 years, 10 months ago) by mjf
Branches: mjf-devfs2
Diff to: previous 1.1.6.1: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.6.1: +150 -0 lines
Sync with HEAD.

Revision 1.1.4.2: download - view: text, markup, annotated - select for diffs
Sat Dec 13 01:15:09 2008 UTC (16 years ago) by haad
Branches: haad-dm
Diff to: previous 1.1.4.1: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.4.1: +150 -0 lines
Update haad-dm branch to haad-dm-base2.

Revision 1.1.12.1
Tue Nov 18 11:36:58 2008 UTC (16 years ago) by yamt
Branches: yamt-nfs-mp
FILE REMOVED
Changes since revision 1.1: +0 -150 lines
file vfs_cwd.c was added on branch yamt-nfs-mp on 2009-05-04 08:13:49 +0000

Revision 1.1.8.1
Tue Nov 18 11:36:58 2008 UTC (16 years ago) by skrll
Branches: nick-hppapmap
FILE REMOVED
Changes since revision 1.1: +0 -150 lines
file vfs_cwd.c was added on branch nick-hppapmap on 2009-01-19 13:19:40 +0000

Revision 1.1.6.1
Tue Nov 18 11:36:58 2008 UTC (16 years ago) by mjf
Branches: mjf-devfs2
FILE REMOVED
Changes since revision 1.1: +0 -150 lines
file vfs_cwd.c was added on branch mjf-devfs2 on 2009-01-17 13:29:20 +0000

Revision 1.1.4.1
Tue Nov 18 11:36:58 2008 UTC (16 years ago) by haad
Branches: haad-dm
FILE REMOVED
Changes since revision 1.1: +0 -150 lines
file vfs_cwd.c was added on branch haad-dm on 2008-12-13 01:15:09 +0000

Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue Nov 18 11:36:58 2008 UTC (16 years ago) by pooka
Branches: MAIN
CVS tags: yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, mjf-devfs2-base, jymxensuspend-base, jym-xensuspend-base, jym-xensuspend, haad-nbase2, haad-dm-base2, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Branch point for: yamt-nfs-mp, nick-hppapmap, mjf-devfs2, haad-dm
cwd is logically a vfs concept, so take it out from the bosom of
kern_descrip and into vfs_cwd.  No functional change.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>