Skip to content

sync livelock fixes v2

Wu Fengguang linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 15 repliesIn review

changes from v1 from the cover letter

- retain tagged sync behavior for all WB_SYNC_ALL callers (Dave Chinner)
- rename wbc.for_sync to wbc.tagged_sync
- remove the changes to trace events

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3writeback: introduce wbc.tagged_sync for the WB_SYNC_NONE sync stagefs/ext4/inode.c fs/fs-writeback.c include/linux/writeback.h +1 more+10 -84 replies
2/3writeback: update dirtied_when for synced inode to prevent livelockfs/fs-writeback.c+9 -02 replies
3/3writeback: avoid extra sync work at enqueue timefs/fs-writeback.c include/linux/writeback.h+4 -169 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] sync livelock fixes v2

Andrew,

changes from v1:
- retain tagged sync behavior for all WB_SYNC_ALL callers (Dave Chinner)
- rename wbc.for_sync to wbc.tagged_sync
- remove the changes to trace events

The below sync livelock test script is working fine after this patchset:

sync time: 2
Dirty: 26492 kB
Writeback: 30260 kB
NFS_Unstable: 0 kB
WritebackTmp: 0 kB
sync NOT livelocked

In particular patch 2 fixes the sync livelock problem introduced by patch "writeback: try more writeback as long as something was written".

Thanks,
Fengguang
---

#!/bin/sh

umount /dev/sda7

# mkfs.xfs -f /dev/sda7
mkfs.ext4 /dev/sda7
mount /dev/sda7 /fs

echo $((50<<20)) > /proc/sys/vm/dirty_bytes

pid=
for i in seq 10
do

        dd if=/dev/zero of=/fs/zero-$i bs=1M count=1000 &
        pid="$pid $!"

done

sleep 1

tic=$(date +'%s')
sync
tac=$(date +'%s')

echo
echo sync time: $((tac-tic))
egrep '(Dirty|Writeback|NFS_Unstable)' /proc/meminfo

pidof dd > /dev/null && { kill -9 $pid; echo sync NOT livelocked; }