On Thu, Dec 17, 2020 at 07:05:37PM +0000, Joao Martins wrote: > > No reason not to fix set_page_dirty_lock() too while you are here. > > The wack of atomics you mentioned earlier you referred to, I suppose it > ends being account_page_dirtied(). See partial diff at the end. Well, even just eliminating the lock_page, page_mapping, PageDirty, etc is already a big win. If mapping->a_ops->set_page_dirty() needs to be called multiple times on the head page I'd probably just suggest: while (ntails--) rc |= (*spd)(head); At least as a start. If you have workloads that have page_mapping != NULL then look at another series to optimze that. Looks a bit large though given the number of places implementing set_page_dirty I think the current reality is calling set_page_dirty on an actual file system is busted anyhow, so I think mapping is generally going to be NULL here? Jason