On 12/19/20 2:06 AM, John Hubbard wrote:
On 12/17/20 12:05 PM, Jason Gunthorpe wrote:
> 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);
I think once should be enough. There is no counter for page dirtiness,
and this kind of accounting is always tracked in the head page, so there
is no reason to repeatedly call set_page_dirty() from the same
I think that's what we do even today, considering the Dirty bit is only set on
compound head (regardless of accounting). Even without this patch,
IIUC we don't call a second set_page_dirty(head) after the first time
we dirty it. So probably there's no optimization to do here, as you say.