On Wed 02-08-17 20:52:51, Andrew Perepechko wrote: > > On Tue 01-08-17 15:02:42, Jan Kara wrote: > > > When several processes race updating the same dquot, they very often all > > > end up updating dquot on disk even though another process has already > > > written dquot for them while they were waiting for dqio_sem - in my test > > > above the ratio of commit_dqblk / dquot_commit calls was 59%. What we > > > could > > > do is that dquot_mark_dquot_dirty() would return "current sequence of > > > dquot", dquot_commit() would then get sequence that is required to be > > > written and if that is already written (we would also store in dquot > > > latest > > > written sequence), it would bail out doing nothing. This should cut down > > > dqio_mutex hold times and thus wait times but I need to experiment and > > > measure that... > > > > I've been experimenting with this today but this idea didn't bring any > > benefit in my testing. Was your setup with multiple users or a single user? > > Could you give some testing to my patches to see whether they bring some > > benefit to you? > > > > Honza > > Hi Jan! > > My setup was with a single user. Unfortunately, it may take some time before > I can try a patched kernel other than RHEL6 or RHEL7 with the same test, > we have a lot of dependencies on these kernels. > > The actual test we ran was mdtest. > > By the way, we had 15+% performance improvement in creates from the > change that was discussed earlier in this thread: > > EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { > + if (test_bit(DQ_MOD_B, &dquot->dq_flags)) > + return 0; > dquot_mark_dquot_dirty(dquot); > return ext4_write_dquot(dquot); > > The idea was that if we know that some thread is somewhere between > mark_dirty and clear_dirty, then we can avoid blocking on dqio_mutex, > since that thread will update the ondisk dquot for us. > > I think, you also mentioned that some mark_dquot_dirty callers, such > as do_set_dqblk, may not be running with an open transaction handle, > so we cannot assume this optimization is atomic. However, we don't > use do_set_dqblk and seem safe wrt journalling. OK, thanks for info. I'm reluctant to make ext4_mark_dquot_dirty() return before quota data is actually copied to the transaction which is what probably brings you the benefit. I'll think about it some more. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR