Page MenuHomeFreeBSD

linuxkpi: Add shrinker support
ClosedPublic

Authored by manu on Dec 22 2020, 6:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 10 2024, 9:37 PM
Unknown Object (File)
Feb 3 2024, 8:15 AM
Unknown Object (File)
Dec 20 2023, 5:48 PM
Unknown Object (File)
Dec 20 2023, 5:43 AM
Unknown Object (File)
Dec 17 2023, 9:32 AM
Unknown Object (File)
Oct 14 2023, 3:31 AM
Unknown Object (File)
Aug 2 2023, 8:39 AM
Unknown Object (File)
Jan 7 2023, 10:48 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

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

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.