On Mon, Nov 5, 2018 at 10:28 AM Yang Shi <yang....@linux.alibaba.com> wrote: > > Actually, the commit is mainly for optimizing the long stall time caused > by holding mmap_sem by write when unmapping or shrinking large mapping. > It downgrades write mmap_sem to read when zapping pages. So, it looks > the downgrade incurs more context switches. This is kind of expected. > > However, the test looks just shrink the mapping with one normal 4K page > size. It sounds the overhead of context switches outpace the gain in > this case at the first glance.
I'm not seeing why there should be a context switch in the first place. Even if you have lots of concurrent brk() users, they should all block exactly the same way as before (a write lock blocks against a write lock, but it *also* blocks against a downgraded read lock). So no, I don't want just some limit to hide this problem for that particular test. There's something else going on. Linus