{% raw %}
Maksadbek

Nice article, thanks

Janus Troelsen

"We have some well tested B-tree" Where can I find the source code for that B-tree implementation?

Philipp Oppermann

In the btree module of libcollections: https://github.com/rust-lan...

The rendered documentation is here.

Philipp Oppermann

There is some discussion on /r/rust, hacker news, and /r/programming.

Ryan Breen

Love this series of articles! I'm very new to Rust and kernel development, and I've really enjoyed following along and trying to experiment a bit with alternative implementations. In that vein, I ported the inimitable gz's rust-slabmalloc (https://github.com/gz) to run in my implementation of these tutorials: https://github.com/ryanbree...

One potentially interesting approach I tried, taking a bit of a page from Linux which I know uses a dumbed down allocator for the early allocation during kernel boot, is to have my Rust allocator be tiered: during early kernel boot, it uses a bump allocator. The only allocations done by the bump allocator are to set up the memory to be used by the slab_allocator. This meant I could get the benefit of collections when porting slab_allocator, so I dropped its internal data structure in favor of a plain old vec.

Thanks for this series! You're doing awesome work and giving people a world of new educational opportunities.

Philipp Oppermann

Thanks so much!

I really like your approach of building allocators on top of each other (and I will take a closer look when I have some time). Maybe it's even possible to create an allocator based on a B-tree…?

Johan M

Ahh, I see that the API to custom allocators changed :-0 I see that the code in git is updated but not for the bump_allocator. Even if one can work around it to conform to the new interface it is puzzling before you figure out what the problem is.

A guide to the new allocator:

https://github.com/rust-lang/rfcs/blob/master/text/1974-global-allocators.md

Johan M

Best strategy might be to go directly to the hole_list_allocator but to start up simple and ignore trying to reclaim blocks; that way the transition is easier.

Philipp Oppermann

I didn't have the time to update this post yet, sorry. The code in the repository is up-to-date, but adjusting this post would be more work. I try to update it soon.

Philipp Oppermann
Johan Montelius

I like the idea of introducing a simple Bump allocator since it show how little we need to do to get dynamic memory allocation working. My rust skills are still modest but I'll give it a try to rewrite it using the new interface.

Philipp Oppermann

Yes, updating the bump allocator is definitely planned. Pull requests are always appreciated, if you like to submit it!

Anonym

The link to "the book" is not valid when talking about the allocator functions one needs to implement

{% endraw %}