AF_XDP - why setrlimit() ?
Srivats P <[email protected]>
| Newsgroups | org.kernel.vger.xdp-newbies |
|---|---|
| Message-ID | <CANzUK5_NfMLh9+se3hdJ176Ow_At6bwPqUSUD8XOSO0yc4vYig@mail.gmail.com> |
Hi, The sample xdpsock_user.c program does a setrlimit(RLIMIT_MEMLOCK) but subsequently doesn't do a mlock or pass MAP_LOCKED flag to mmap(). Same with xdp-tutorial which has the following comment but I don't see any locking happening anywhere in the code. /* Allow unlimited locking of memory, so all memory needed for packet * buffers can be locked. */ What is the purpose behind this setrlimit? Does the libbpf/xdp library do a mlock internally? I came to know that BPF maps need the setrlimit and I assume the xsk APIs create a XSK map internally - so is that the only reason? Didn't find any references to setrlimit in https://www.kernel.org/doc/html/latest/networking/af_xdp.html either. Srivats