On 2021/5/11 上午11:04, Bruce Ashfield wrote:
[Please note: This e-mail is from an EXTERNAL e-mail address]

The patch looks good, but is it for 5.10/rt ? Or some other version and
set of branches ?


Hi bruce

v5.2/standard/preempt-rt

The detail info was written in email  "[linux-yocto] [PATCH 0/1] fs: dcache: avoid livelocks on d_alloc_parallel",

please check it, thanks.



Bruce


In message: [PATCH 0/1] fs: dcache: avoid livelocks on d_alloc_parallel
on 08/05/2021 Kang Wenlin wrote:

From: Wenlin Kang <[email protected]>

With RT, if a high priority task that runs d_alloc_parallel() preempts a
low priority task that runs __d_add(), it can make d_alloc_parallel() go
into an infinite retry.

low priority task:                  high priority task:
__lookup_slow()
d_add()
     __d_add
         start_dir_add(dir)          __lookup_slow()
                                         d_alloc_parallel()

When the low priority task finished start_dir_add(), i_dir_seq has been
incremented to an odd value. Since __d_add() uses spin_lock(), migration
is disabled, so if the low priority task is preempted during start_dir_add()
/end_dir_add(), then high priority task can go into an infinite waiting for
i_dir_seq.

This patch avoid the issue by enable preempt_disable() during start_dir_add()
/end_dir_add().


Steps to reproduce:
$ taskset -c 1 chrt -f 70 ./test1.sh &
$ taskset -c 1 chrt -f 80 ./test2.sh &

After about 30 minutes, check whether serial console responds.
The problem happens with specific script combinations(test1.sh and test2.sh)

This problem was reproduced on v4.12 with preempt-rt, but I think it should be
exist on v5.2/standard/preempt-rt

P.S.
$ cat test1.sh
#!/bin/bash

while true; do
       usleep 1
done

$ cat test2.sh
#!/bin/bash

while true; do
       cat /proc/stat > /dev/null
       usleep 100
done


Wenlin Kang (1):
   fs: dcache: avoid livelocks on d_alloc_parallel

  fs/dcache.c | 6 ++++++
  1 file changed, 6 insertions(+)

--
1.9.1


--
Thanks,
Wenlin Kang

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9862): 
https://lists.yoctoproject.org/g/linux-yocto/message/9862
Mute This Topic: https://lists.yoctoproject.org/mt/82675356/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to