From: Alexei Starovoitov
Sent: 16 December 2020 02:36
...
quoted
The problem is never about granularity, it is about how efficient we can
GC. User-space has to scan the whole table one by one, while the kernel
can just do this behind the scene with a much lower overhead.
Let's say we arm a timer for each entry in user-space, it requires a syscall
and locking buckets each time for each entry. Kernel could do it without
any additional syscall and batching. Like I said above, we could have
millions of entries, so the overhead would be big in this scenario.
and the user space can pick any other implementation instead
of trivial entry by entry gc with timer.
The kernel can also gc entries when scanning hash lists during insert
(or even during lookup if not using rw locks).
Apart from the memory use there isn't really a problem having timed-out
entries in the hash table if nothing is looking at them.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)