On 2021-05-25 3:57 p.m., Alexei Starovoitov wrote:
On Tue, May 25, 2021 at 12:35 PM Jamal Hadi Salim <jhs@xxxxxxxxxxxx> wrote:
[..]
The outcome of the last bpf office hours was a general agreement that we need new hooks in map update/delete operations (including auto-delete by LRU) that will trigger a bpf subprog.
This is certainly a useful feature (for other reasons as well). Does this include create/update/delete issued from user space?
It might look very similar to the timer callback that is part of this patch, but instead of being called by the timer the LRU logic will call it. This way the subprog can transfer the data stored in the about-to-be-deleted map element into some other map or pass to user space via ringbuf or do any other logic.
The challenge we have in this case is LRU makes the decision which entry to victimize. We do have some entries we want to keep longer - even if they are not seeing a lot of activity. You could just notify user space to re-add the entry but then you have sync challenges. The timers do provide us a way to implement custom GC. So a question (which may have already been discussed), assuming the following setup: - 2 programs a) Ingress b) egress - sharing a conntrack map which and said map pinned. - a timer prog (with a map with just timers; even a single timer would be enough in some cases). ingress and egress do std stuff like create/update timer prog does the deletes. For simplicity sake assume we just have one timer that does a foreach and iterates all entries. What happens when both ingress and egress are ejected? cheers, jamal