tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Introducing localcount(9)



On Wed, 17 May 2017, Robert Elz wrote:

   Date:        Tue, 16 May 2017 16:47:24 -0700
   From:        Chuck Silvers <chuq%chuq.com@localhost>
   Message-ID:  <20170516234724.GB11062%spathi.chuq.com@localhost>

 | and a device being configured as a dump device should also
 | involve keeping a reference on the device_t (probably indirectly via
 | the device being kept open while it is configured as a dump device).

Wouldn't that prevent the dump device being used for swapping (ie: the
common setup where dumps just overwrite swap when the system crashes) ?

Or at least I'd hope that enabling swapping on an open device is prevented!

Localcount references are just references/counts, not interlocks. In fact, there is no way to ask "what is the current count?" Other than incrementing and decrementing the count, the only operation available is "Wait for count == 0". Nothing else.

The intent is basically to delay deletion of an object until all of the object's users have released their reference. No intention or ability to prevent new usage of the object.

WRT the dump device, if a device is marked as a dump device, then the localcount reference will prevent (actually, only delay) completion of any attempt to detach the device. The detach code will wait until the reference count drops to zero, which will of course only happen when the "I'm-a-dump-device" characteristic is removed.



+------------------+--------------------------+----------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+


Home | Main Index | Thread Index | Old Index