Re: [PATCH 3/7] Make TestSetPageDirty and dirty page accounting inone func

From: Kamezawa Hiroyuki
Date: Mon Jul 02 2012 - 07:16:32 EST


(2012/06/28 20:01), Sha Zhengju wrote:
> From: Sha Zhengju <handai.szj@xxxxxxxxxx>
>
> Commit a8e7d49a(Fix race in create_empty_buffers() vs __set_page_dirty_buffers())
> extracts TestSetPageDirty from __set_page_dirty and is far away from
> account_page_dirtied.But it's better to make the two operations in one single
> function to keep modular.So in order to avoid the potential race mentioned in
> commit a8e7d49a, we can hold private_lock until __set_page_dirty completes.
> I guess there's no deadlock between ->private_lock and ->tree_lock by quick look.
>
> It's a prepare patch for following memcg dirty page accounting patches.
>
> Signed-off-by: Sha Zhengju <handai.szj@xxxxxxxxxx>

I think there is no problem with the lock order.

My small concern is the impact on the performance. IIUC, lock contention here can be
seen if multiple threads write to the same file in parallel.
Do you have any numbers before/after the patch ?


Thanks,
-Kmae

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/