Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-19 Thread Huang, Ying
"Paul E. McKenney" writes: > On Tue, Dec 19, 2017 at 09:57:21AM +0800, Huang, Ying wrote: >> "Paul E. McKenney" writes: >> >> > On Mon, Dec 18, 2017 at 03:41:41PM +0800, Huang, Ying wrote: >> >> "Huang, Ying"

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-19 Thread Huang, Ying
"Paul E. McKenney" writes: > On Tue, Dec 19, 2017 at 09:57:21AM +0800, Huang, Ying wrote: >> "Paul E. McKenney" writes: >> >> > On Mon, Dec 18, 2017 at 03:41:41PM +0800, Huang, Ying wrote: >> >> "Huang, Ying" writes: >> >> And, it appears that if we replace smp_wmb() in _enable_swap_info()

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-18 Thread Paul E. McKenney
On Tue, Dec 19, 2017 at 09:57:21AM +0800, Huang, Ying wrote: > "Paul E. McKenney" writes: > > > On Mon, Dec 18, 2017 at 03:41:41PM +0800, Huang, Ying wrote: > >> "Huang, Ying" writes: > >> And, it appears that if we replace smp_wmb() in

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-18 Thread Paul E. McKenney
On Tue, Dec 19, 2017 at 09:57:21AM +0800, Huang, Ying wrote: > "Paul E. McKenney" writes: > > > On Mon, Dec 18, 2017 at 03:41:41PM +0800, Huang, Ying wrote: > >> "Huang, Ying" writes: > >> And, it appears that if we replace smp_wmb() in _enable_swap_info() with > >> stop_machine() in some way,

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-18 Thread Paul E. McKenney
On Mon, Dec 18, 2017 at 03:41:41PM +0800, Huang, Ying wrote: > "Huang, Ying" writes: > > > From: Huang Ying > > > > When the swapin is performed, after getting the swap entry information > > from the page table, system will swap in the swap entry,

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-18 Thread Paul E. McKenney
On Mon, Dec 18, 2017 at 03:41:41PM +0800, Huang, Ying wrote: > "Huang, Ying" writes: > > > From: Huang Ying > > > > When the swapin is performed, after getting the swap entry information > > from the page table, system will swap in the swap entry, without any > > lock held to prevent the swap

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-18 Thread Junaid Shahid
On Monday, December 18, 2017 3:41:41 PM PST Huang, Ying wrote: > > A version implemented via stop_machine() could be gotten via a small > patch as below. If you still prefer stop_machine(), I can resend a > version implemented with stop_machine(). > For the stop_machine() version, would it

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-18 Thread Junaid Shahid
On Monday, December 18, 2017 3:41:41 PM PST Huang, Ying wrote: > > A version implemented via stop_machine() could be gotten via a small > patch as below. If you still prefer stop_machine(), I can resend a > version implemented with stop_machine(). > For the stop_machine() version, would it

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-17 Thread Huang, Ying
"Huang, Ying" writes: > From: Huang Ying > > When the swapin is performed, after getting the swap entry information > from the page table, system will swap in the swap entry, without any > lock held to prevent the swap device from being swapoff. This

Re: [PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-17 Thread Huang, Ying
"Huang, Ying" writes: > From: Huang Ying > > When the swapin is performed, after getting the swap entry information > from the page table, system will swap in the swap entry, without any > lock held to prevent the swap device from being swapoff. This may > cause the race like below, > > CPU 1

[PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-17 Thread Huang, Ying
From: Huang Ying When the swapin is performed, after getting the swap entry information from the page table, system will swap in the swap entry, without any lock held to prevent the swap device from being swapoff. This may cause the race like below, CPU 1

[PATCH -V3 -mm] mm, swap: Fix race between swapoff and some swap operations

2017-12-17 Thread Huang, Ying
From: Huang Ying When the swapin is performed, after getting the swap entry information from the page table, system will swap in the swap entry, without any lock held to prevent the swap device from being swapoff. This may cause the race like below, CPU 1 CPU 2 -