Re: [PATCH bpf-next v3] docs/bpf: Add LRU internals description and graph

From: Joe Stringer
Date: Wed Mar 15 2023 - 21:22:39 EST


On Tue, Mar 14, 2023 at 6:55 AM Maxim Mikityanskiy <maxtram95@xxxxxxxxx> wrote:
>
> On Sun, Mar 12, 2023 at 12:05:59PM -0700, Joe Stringer wrote:

<snip>

> I believe there are some inaccuracies, though. As far as I see it,
> local_freelist_check corresponds to __local_list_pop_free in the common
> LRU case, specifically, to checking its return value; use_local_node
> corresponds to returning that value; and common_lru_check corresponds
> to bpf_lru_pop_free (for both common and percpu LRU, that's where the
> distinction is made).

Ah yes, thanks for the pointers, will fix up. I started with reviewing
the shared case since I was primarily interested in the behaviour
there, then I added the other cases later. Adding the function names
was one of the later ideas but it's difficult to get accurate.

> > + local_freelist_check [shape=diamond,fillcolor=1,
> > + label="Local freelist\nnode available?"];
> > + // The following corresponds to __local_list_pop_free() for common LRU case.
> > + use_local_node [shape=rectangle,
> > + label="Use node owned\nby this CPU"]
> > +
> > + common_lru_check [shape=diamond,
> > + label="Map created with\ncommon LRU?\n(!BPF_NO_COMMON_LRU)"];
>
> Nit: the exact flag name is BPF_F_NO_COMMON_LRU.

Will fix.

> Thanks again for this patch, this piece of documentation really helped
> me understand internals of the LRU hashmap.

Glad to hear, thanks for the feedback on the patch!