On 2024/10/25 22:07, Jesper Dangaard Brouer wrote: ... > >>> You and Jesper seems to be mentioning a possible fact that there might >>> be 'hundreds of gigs of memory' needed for inflight pages, it would be nice >>> to provide more info or reasoning above why 'hundreds of gigs of memory' is >>> needed here so that we don't do a over-designed thing to support recording >>> unlimited in-flight pages if the driver unbound stalling turns out impossible >>> and the inflight pages do need to be recorded. >> >> I don't have a concrete example of a use that will blow the limit you >> are setting (but maybe Jesper does), I am simply objecting to the >> arbitrary imposing of any limit at all. It smells a lot of "640k ought >> to be enough for anyone". >> > > As I wrote before. In *production* I'm seeing TCP memory reach 24 GiB > (on machines with 384GiB memory). I have attached a grafana screenshot > to prove what I'm saying. > > As my co-worker Mike Freemon, have explain to me (and more details in > blogposts[1]). It is no coincident that graph have a strange "sealing" > close to 24 GiB (on machines with 384GiB total memory). This is because > TCP network stack goes into a memory "under pressure" state when 6.25% > of total memory is used by TCP-stack. (Detail: The system will stay in > that mode until allocated TCP memory falls below 4.68% of total memory). > > [1] https://blog.cloudflare.com/unbounded-memory-usage-by-tcp-for-receive-buffers-and-how-we-fixed-it/ Thanks for the info. > > >>> I guess it is common sense to start with easy one until someone complains >>> with some testcase and detailed reasoning if we need to go the hard way as >>> you and Jesper are also prefering waiting over having to record the inflight >>> pages. >> >> AFAIU Jakub's comment on his RFC patch for waiting, he was suggesting >> exactly this: Add the wait, and see if the cases where it can stall turn >> out to be problems in practice. > > +1 > > I like Jakub's approach. As mentioned in Toke's comment, I am still not convinced that there is some easy way of waiting here, doing the kick in the kernel space is hard enough, I am not even sure if kick need to be done or how it can be done in the user space if some page_pool owned page is held from user space for the cases of zero rx copy, io_uring and devmem tcp? killing the userspace app? If you and Toke still think the waiting is the way out for the problem here, maybe we should wait for jakub's opinion and let him decide if he want to proceed with his waiting patch. > > --Jesper