On 2024/10/30 19:57, Toke Høiland-Jørgensen wrote: > Yunsheng Lin <linyunsheng@xxxxxxxxxx> writes: > >>> But, well, I'm not sure it is? You seem to be taking it as axiomatic >>> that the wait in itself is bad. Why? It's just a bit memory being held >>> on to while it is still in use, and so what? >> >> Actually, I thought about adding some sort of timeout or kicking based on >> jakub's waiting patch too. >> >> But after looking at more caching in the networking, waiting and kicking/flushing >> seems harder than recording the inflight pages, mainly because kicking/flushing >> need very subsystem using page_pool owned page to provide a kicking/flushing >> mechanism for it to work, not to mention how much time does it take to do all >> the kicking/flushing. > > Eliding the details above, but yeah, you're right, there are probably > some pernicious details to get right if we want to flush all caches. S > I wouldn't do that to start with. Instead, just add the waiting to start > with, then wait and see if this actually turns out to be a problem in > practice. And if it is, identify the source of that problem, deal with > it, rinse and repeat :) I am not sure if I have mentioned to you that jakub had a RFC for the waiting, see [1]. And Yonglong Cc'ed had tested it, the waiting caused the driver unload stalling forever and some task hung, see [2]. The root cause for the above case is skb_defer_free_flush() not being called as mentioned before. I am not sure if I understand the reasoning behind the above suggestion to 'wait and see if this actually turns out to be a problem' when we already know that there are some cases which need cache kicking/flushing for the waiting to work and those kicking/flushing may not be easy and may take indefinite time too, not to mention there might be other cases that need kicking/flushing that we don't know yet. Is there any reason not to consider recording the inflight pages so that unmapping can be done for inflight pages before driver unbound supposing dynamic number of inflight pages can be supported? IOW, Is there any reason you and jesper taking it as axiomatic that recording the inflight pages is bad supposing the inflight pages can be unlimited and recording can be done with least performance overhead? Or is there any better idea other than recording the inflight pages and doing the kicking/flushing during waiting? 1. https://lore.kernel.org/netdev/20240806151618.1373008-1-kuba@xxxxxxxxxx/ 2. https://lore.kernel.org/netdev/758b4d47-c980-4f66-b4a4-949c3fc4b040@xxxxxxxxxx/ > > -Toke > >