Page MenuHomeFreeBSD

linuxkpi: Add tag support to radix tree
ClosedPublic

Authored by dumbbell on Jan 4 2026, 10:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 30, 3:02 AM
Unknown Object (File)
Mon, Jan 26, 5:47 PM
Unknown Object (File)
Sun, Jan 25, 11:15 AM
Unknown Object (File)
Sat, Jan 24, 4:27 PM
Unknown Object (File)
Fri, Jan 23, 9:37 PM
Unknown Object (File)
Tue, Jan 20, 5:06 PM
Unknown Object (File)
Mon, Jan 12, 11:33 PM
Unknown Object (File)
Sun, Jan 11, 6:00 PM

Details

Summary

The tag is used to perform lookup in a different way.

New functions were introduced:

  • to set, check and clear a tag
  • to walk through a radix tree based on a given tag

Furthermore, the radix_tree_delete() function was modified to clear tags on deletion.

The amdgpu DRM driver started to use this in Linux 6.10.

While here, the radix_tree_gang_lookup() function was added because it is very close to radix_tree_gang_lookup_tag(), but it is not used by the DRM drivers as of this commit.

This is part of the update of DRM drivers to Linux 6.10.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I'll likely not be able to review this before next week; I hope someone else will pick it up so v6.10 can go in.

sys/compat/linuxkpi/common/include/linux/radix-tree.h
103

This changes the KPI but I cannot easily find a consumer outside sys/compat/linuxkpi so it's likely fine. Despite its name it is likely not a public KPI function anyway.

christos added inline comments.
sys/compat/linuxkpi/common/src/linux_radix.c
178

In Linux code I see this block here:

		if (radix_tree_is_internal_node(results[ret])) {
			slot = radix_tree_iter_retry(&iter);
			continue;
		}

We don't need it?

204

Ditto.

sys/compat/linuxkpi/common/src/linux_radix.c
178

Looking at Linux history this is fixing a race that doesn't apply to us (or, we're even more fundamentally broken), either way this is OK.

dumbbell added inline comments.
sys/compat/linuxkpi/common/include/linux/radix-tree.h
103

Correct, it doesn’t exist on Linux.

sys/compat/linuxkpi/common/src/linux_radix.c
178

Yeah, our implementation never had this notion of "internal node".

minsoochoo0122_proton.me added inline comments.
sys/compat/linuxkpi/common/src/linux_radix.c
56

Trivial, but this could be const. Unlike test_bit which shouldn't have const to match signature, root_tag_get is static so adding const wouldn't be problematic. This also applies to other parameters in functions below.

dumbbell added inline comments.
sys/compat/linuxkpi/common/src/linux_radix.c
56

I know it’s an internal private function but it matches signature on Linux.

This revision is now accepted and ready to land.Tue, Jan 27, 7:08 PM
This revision was automatically updated to reflect the committed changes.