Page MenuHomeFreeBSD

linuxkpi: Add shrinker support
ClosedPublic

Authored by manu on Dec 22 2020, 6:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 10, 6:33 PM
Unknown Object (File)
Thu, Dec 5, 7:21 PM
Unknown Object (File)
Wed, Dec 4, 7:40 PM
Unknown Object (File)
Thu, Nov 28, 4:16 PM
Unknown Object (File)
Wed, Nov 27, 11:27 PM
Unknown Object (File)
Sat, Nov 23, 10:43 AM
Unknown Object (File)
Sat, Nov 23, 8:38 AM
Unknown Object (File)
Nov 19 2024, 2:05 AM
Subscribers

Details

Summary

A driver can register a shrinker that will be called when the kernel
wants to free some memory.
Add support for that in linuxkpi and call the registered shrinkers
when the lowmem event is triggered.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

manu requested review of this revision.Dec 22 2020, 6:19 PM
bz added inline comments.
sys/compat/linuxkpi/common/src/linux_shrinker.c
48

I always wonder if we should document that fields are initialised by at least adding KASSERT()s?
I guess I've been calling too many NULL function pointers lately elsewhere which were never initialised or checked on registration.

71

batch is not needed until line 79; can it be initialised after the initial return?

78

No { } needed.

108

Long line.

sys/compat/linuxkpi/common/src/linux_shrinker.c
48

you mean adding something like KASSERT(s->count_objects == NULL, ...) ?
Anyway yeah I think that I should check that both function pointer are not NULL here.

71

Will change.

78

printf debugging leftover :)
I'll change that.

108

Will change.

manu marked 4 inline comments as done.

Looks good scrolling through now.

This revision is now accepted and ready to land.Jan 2 2021, 1:56 PM
This revision was automatically updated to reflect the committed changes.