> On 5 Mar 2025, at 20:15, SeongJae Park <sj@xxxxxxxxxx> wrote: > > For MADV_DONTNEED[_LOCKED] or MADV_FREE madvise requests, tlb flushes > can happen for each vma of the given address ranges. Because such tlb > flushes are for address ranges of same process, doing those in a batch > is more efficient while still being safe. Modify madvise() and > process_madvise() entry level code path to do such batched tlb flushes, > while the internal unmap logics do only gathering of the tlb entries to > flush. I made some related (similar?) patches in the past. You can see if you find something useful in the discussion there. I think your version avoids some of the “mistakes” I made. [1] https://lore.kernel.org/all/20210926161259.238054-1-namit@xxxxxxxxxx/T/#m23ccd29bad04a963c4d8c64ec3581f7c301c7806