LWN: Comments on "Slabs, sheaves, and barns" https://lwn.net/Articles/1010667/ This is a special feed containing comments posted to the individual LWN article titled "Slabs, sheaves, and barns". en-us Thu, 23 Oct 2025 14:50:28 +0000 Thu, 23 Oct 2025 14:50:28 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net What exactly is an object? https://lwn.net/Articles/1012066/ https://lwn.net/Articles/1012066/ aviallon <div class="FormattedComment"> You can simply open a bug on the kernel bugzilla<br> </div> Thu, 27 Feb 2025 09:28:17 +0000 mixed metaphor https://lwn.net/Articles/1011872/ https://lwn.net/Articles/1011872/ paulj <div class="FormattedComment"> "Just stick to the existing terms, already described in the literature" is not bike-shedding.<br> </div> Wed, 26 Feb 2025 09:56:26 +0000 Not much like mempools https://lwn.net/Articles/1011848/ https://lwn.net/Articles/1011848/ neilbrown <div class="FormattedComment"> <span class="QuotedText">&gt; These special-purpose sheaves act similarly to mempools, </span><br> <p> I guess it depends on what you mean by "similarly" but I think the above is misleading.<br> <p> A vital property of mempools is that if memory cannot be allocated (because it is all in use), then the mempool allocation will wait for something to be returned to the mempool - and it can be certain that something *will* be returned to the mempool in a reasonable time.<br> <p> If a mempool provides "struct bio" that can be used to write a page to a device, then you can be sure that waiting on the mempool will only wait until a currently outstanding write to the device completes - then that bio will become available.<br> <p> So a mempool is not at all about being able to allocate memory with out blocking. It is precisely about blocking at most a predictable amount of time for memory to become available.<br> <p> In contrast, sheaves seem to be about maximising the chance of allocating without blocking. Preallocating before taking a spinlock but while pinned to a given CPU - so an allocation under the spinlock must succeed - is great, but there is no guarantee that the preallocation will succeed - so code would need a fallback or an indefinite wait. mempools provide a definite wait.<br> <p> sheaves improve throughput and simplify code. mempools avoid deadlocks.<br> <p> <p> </div> Wed, 26 Feb 2025 00:43:58 +0000 What exactly is an object? https://lwn.net/Articles/1011816/ https://lwn.net/Articles/1011816/ tialaramex <div class="FormattedComment"> It doesn't seem useful to say "It's like method syntax except without the same syntax". That's just not method syntax. Some languages have Unified Method Call Syntax, so _all_ functions in the language which take at least one argument can be used as method calls. Rust only has the other side of that coin, all the methods in the language can also be treated as free functions with an extra argument - but not vice versa.<br> <p> C++ ADL which maybe you were also gesturing at is just a mess. Your whatever function is indeed treated by C++ as if it's "part of Foo's interface" but only when it was defined in the same namespace so that ADL will find whatever when it is looking up Foo. This causes weird hard to understand issues in real world C++ software because what foo(bar) means will depend on the context in which you wrote it in non-obvious ways, as a result "turning off ADL" via arcane tricks is often needed &amp; there have been attempts to reform ADL or to add explicit "No ADL please" features to the language.<br> <p> I was serious about that docbug, who do I raise this with? I'd rather raise it as a bug rather than sending a patch because I'm certain those answering the bug ticket will know more than I do about kmalloc<br> </div> Tue, 25 Feb 2025 20:09:18 +0000 mixed metaphor https://lwn.net/Articles/1011801/ https://lwn.net/Articles/1011801/ JoeBuck <div class="FormattedComment"> Perhaps "shed" should go in here somewhere, since we're clearly into bikeshedding territory.<br> <p> </div> Tue, 25 Feb 2025 19:14:58 +0000 mixed metaphor https://lwn.net/Articles/1011793/ https://lwn.net/Articles/1011793/ paulj <div class="FormattedComment"> Might as well stick to the original terminology from kmem/umem, as published in the USENIX paper - slabs go into magazines, magazines into depots.<br> </div> Tue, 25 Feb 2025 16:15:07 +0000 Sheaves https://lwn.net/Articles/1011792/ https://lwn.net/Articles/1011792/ paulj <div class="FormattedComment"> Indeed. See the 2001 USENIX paper: <a href="https://www.usenix.org/legacy/publications/library/proceedings/usenix01/full_papers/bonwick/bonwick.pdf">https://www.usenix.org/legacy/publications/library/procee...</a><br> <p> The allocator is available in userspace in libumem (which should port relatively easily to other Unixes, and indeed some have put such ports on github).<br> </div> Tue, 25 Feb 2025 16:12:24 +0000 What exactly is an object? https://lwn.net/Articles/1011791/ https://lwn.net/Articles/1011791/ rweikusat2 <div class="FormattedComment"> That's true for kmalloc allocations. For actual slab allocations, an object is the pair (&lt;size&gt;, &lt;type&gt;). Bonwick's (SunOS) original slab allocator had constructors and destructors as the basic idea was to cache constructed objects. This doesn't seem to be the case for Linux, though (at least, I couldn't find a reference to something like this while looking. The type is an important bit of metainformation about usage patterns.<br> </div> Tue, 25 Feb 2025 16:01:18 +0000 What exactly is an object? https://lwn.net/Articles/1011704/ https://lwn.net/Articles/1011704/ Sesse <div class="FormattedComment"> C++ does, in a sense, have this; it's just that the syntax is different. The philosophy is simple: Something can be a part of the class' interface without being a method (or member function, in C++ parlance). E.g., operator==(const Foo&amp;, const Foo&amp;) can be defined well outside of Foo, and then follows the normal rules for free functions. Something as simple as void whatever(const Foo&amp;) can be seen a part of Foo's interface; in fact, it is commonly preferred if you can implement it not as a friend.<br> <p> Of course, adding _data members_ to another class from the outside would be nearly impossible in C++'s compilation model (which it, of course, inherited from C).<br> </div> Tue, 25 Feb 2025 10:11:43 +0000 Sheaves https://lwn.net/Articles/1011694/ https://lwn.net/Articles/1011694/ kmeyer <div class="FormattedComment"> Seems to be another rehashing of Bonwick's "magazines" from 2001.<br> </div> Tue, 25 Feb 2025 05:14:16 +0000 Récoltes et semailles https://lwn.net/Articles/1011691/ https://lwn.net/Articles/1011691/ tux3 <div class="FormattedComment"> If we end up with a couple less than perfectly intuitive metaphors, we'll at least be in good company!<br> We might be running out of viable book-related words, but other fields show you can do fine even with much more tortured metaphors than we have.<br> So one might start to wonder whether the problem measures up to the... reams of discussions about it :)<br> </div> Tue, 25 Feb 2025 04:18:37 +0000 mixed metaphor https://lwn.net/Articles/1011687/ https://lwn.net/Articles/1011687/ robert.cohen@anu.edu.au <div class="FormattedComment"> I think your mixing your metaphors in the naming.<br> <p> Sheaves can refer to either a collection of pages in bookbinding. Or collections of wheat stalks.<br> However as far as I know, the term barn isn't used in bookbinding.<br> In bookbinding a collection of sheaves would be a book.<br> If that term is considered too confusing. I guess you could keep your sheaves on a shelf and still be in<br> metaphor.<br> Obviously other bookish terms like stack or library would be a bad idea :-)<br> </div> Tue, 25 Feb 2025 00:41:02 +0000 What exactly is an object? https://lwn.net/Articles/1011678/ https://lwn.net/Articles/1011678/ tialaramex <div class="FormattedComment"> C is at least - in this respect - consistent. C just doesn't have methods, full stop.<br> <p> What's weird is that C++ and Java for some reason give methods to some things but not others. There's no particular reason 'x'.is_lowercase() shouldn't work, which is why it does in Rust, there's no real "extra" work to deliver this compared with my_goose.honk() in both cases the compiler just has to figure out what type the object is and then go find the function to call (a "method") based on that type then fill in that object as a parameter to the function. In 1972 in a few hundred kilobytes of RAM I can well believe that's an unaffordable luxury for Dennis and so its absence from C is not a great surprise, but why implement this and then switch it off for the built-in types in a newer language? Search me.<br> <p> While writing this comment and looking at the Rust docs for Kmalloc I found a doc bug - for a conventional Rust crate I'm pretty clear about how I can report or fix this. But it's not as obvious to me for the kernel code - please tell me I don't need to brave the LKML Jonathan?<br> <p> The text "if `old_layout` is zero-sized `p` does not need to be a pointer returned by this [`Allocator`]." is unnecessary for free() as we do not provide an old_layout parameter. I can't tell (but hopefully the authors know) whether it is appropriate to simply remove this text, or whether in addition some other text should be provided about zero-size things being freed, or not freed as the case may be.<br> </div> Mon, 24 Feb 2025 22:18:54 +0000 LSF/MM/BPF https://lwn.net/Articles/1011662/ https://lwn.net/Articles/1011662/ vbabka <div class="FormattedComment"> Indeed, I've just sent out the related topic for LSF/MM/BPF, including where I expect things to be controversial - <a href="https://lore.kernel.org/all/14422cf1-4a63-4115-87cb-92685e7dd91b@suse.cz/">https://lore.kernel.org/all/14422cf1-4a63-4115-87cb-92685...</a><br> Thanks for the write-up :)<br> </div> Mon, 24 Feb 2025 17:23:23 +0000 What exactly is an object? https://lwn.net/Articles/1011659/ https://lwn.net/Articles/1011659/ dmv <div class="FormattedComment"> No, not on you at all! I have learned that trying to track down the actual meanings of a fair bit of memory management terminology can lead to hours trawling through 1950s-1970s texts with no ultimate enlightenment at the end, so I figured I’d just ask here since I had been wondering about slab “objects”. Thanks!<br> </div> Mon, 24 Feb 2025 17:15:25 +0000 What exactly is an object? https://lwn.net/Articles/1011657/ https://lwn.net/Articles/1011657/ corbet An "object" is just a piece of memory, yes. No methods or other class-like stuff, this is C we're talking about :) <p> Sorry if that wasn't clear. Mon, 24 Feb 2025 17:10:20 +0000 What exactly is an object? https://lwn.net/Articles/1011654/ https://lwn.net/Articles/1011654/ dmv <div class="FormattedComment"> Super basic question, sorry it’s so stupid, but what exactly is an “object” in this context? As far as I can tell, it’s a chunk of memory that’s a certain size (smaller than a page, of course). So if you need 100 bytes for some common purpose P (say, tracking info about access credentials or whatever), the “object” is just that 100 byte chunk of memory. Is that right or are objects more granular than that—e.g., a certain-sized chunk of memory plus a constructor/destructor pair or whatever?<br> </div> Mon, 24 Feb 2025 17:06:07 +0000