In JDK-8244660 I fixed the code cache sweeper for JDK 15. The same problem happens in 11 after back porting JDK-8244278: The sweeper doesn't run until the any of the code heaps are at least 90% full.
The cause are the mostly same:
1) errors in the heuristic - _last_sweep is reset even when no sweep was done
2) missing notify of the sweeper thread that continues to sleep indefinitely. Both possibly_enable_sweep and updates of _time_counter are missing a call to notify.
In 15 and beyond we also can't rely on regular safepoints.
The fix for 8247775 doesn't apply cleanly on 11. I suggest a minimal fix instead of back porting.