fy the mapcount that overlays page_type.
>
> Let's use READ_ONCE to avoid laod tearing (shouldn't make a difference)
> and to make KCSAN happy.
>
> Note: nothing should really be broken besides wrong KCSAN complaints.
>
> Reported-by: kernel test robot
> Closes: https://lore.kernel.org/oe-lkp/202405281431.c46a3be9-...@intel.com
> Signed-off-by: David Hildenbrand
LGTM. Thanks for fixing.
Reviewed-by: Miaohe Lin
Thanks.
.
On 2023/7/6 19:58, Xiao Yang wrote:
> On 2023/7/6 14:39, Miaohe Lin wrote:
>> It appears that destroy_memory_type() isn't a very good name because
>> we usually will not free the memory_type here. So rename it to a more
>> appropriate name i.e. put_memory_type().
>&
It appears that destroy_memory_type() isn't a very good name because
we usually will not free the memory_type here. So rename it to a more
appropriate name i.e. put_memory_type().
Suggested-by: Huang, Ying
Signed-off-by: Miaohe Lin
---
drivers/dax/kmem.c | 4 ++--
include/
s Zhou and Tim Chen.
Miaohe Lin (4):
mm/swapfile: use percpu_ref to serialize against concurrent swapoff
swap: fix do_swap_page() race with swapoff
mm/swap: remove confusing checking for non_swap_entry() in
swap_ra_info()
mm/shmem: fix shmem_swapin() race with swapoff
include/linux/
Fixes: 0bcac06f27d7 ("mm,swap: skip swapcache for swapin of synchronous device")
Reported-by: kernel test robot (auto build test ERROR)
Signed-off-by: Miaohe Lin
---
include/linux/swap.h | 9 +
mm/memory.c | 9 +
2 files changed, 18 insertions(+)
diff --git a/incl
x27;s used together with RCU solution.
Signed-off-by: Miaohe Lin
---
include/linux/swap.h | 5 +--
mm/swapfile.c| 79 +++-
2 files changed, 52 insertions(+), 32 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1447270
backing device is congested or
not")
Signed-off-by: Miaohe Lin
---
mm/shmem.c | 6 ++
1 file changed, 6 insertions(+)
diff --git a/mm/shmem.c b/mm/shmem.c
index 26c76b13ad23..936ba5595297 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1492,15 +1492,21 @@ static void shmem_pseudo_vma
have enough checking when we really
operate the PTE entries later. So checking for non_swap_entry() is not
really needed here and should be removed to avoid confusion.
Signed-off-by: Miaohe Lin
---
mm/swap_state.c | 6 --
1 file changed, 6 deletions(-)
diff --git a/mm/swap_state.c b
On 2021/4/19 15:52, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/19 15:09, Huang, Ying wrote:
>>> Miaohe Lin writes:
>>>
>>>> On 2021/4/19 10:48, Huang, Ying wrote:
>>>>> Miaohe Lin writes:
>>>>>
>>
On 2021/4/19 15:41, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/19 15:04, Huang, Ying wrote:
>>> Miaohe Lin writes:
>>>
>>>> On 2021/4/19 10:15, Huang, Ying wrote:
>>>>> Miaohe Lin writes:
>>>>>
>&g
On 2021/4/19 15:09, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/19 10:48, Huang, Ying wrote:
>>> Miaohe Lin writes:
>>>
>>>> We will use percpu-refcount to serialize against concurrent swapoff. This
>>>> patch adds the percpu_ref
On 2021/4/19 15:04, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/19 10:15, Huang, Ying wrote:
>>> Miaohe Lin writes:
>>>
>>>> When I was investigating the swap code, I found the below possible race
>>>> window:
>>&
On 2021/4/19 10:54, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> Use percpu_ref to serialize against concurrent swapoff. Also remove the
>> SWP_VALID flag because it's used together with RCU solution.
>>
>> Signed-off-by: Miaohe Lin
>> ---
>>
On 2021/4/19 10:23, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> When I was investigating the swap code, I found the below possible race
>> window:
>>
>> CPU 1CPU 2
>> --
On 2021/4/19 10:15, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> When I was investigating the swap code, I found the below possible race
>> window:
>>
>> CPU 1 CPU 2
>> -
On 2021/4/19 9:53, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> While we released the pte lock, somebody else might faulted in this pte.
>> So we should check whether it's swap pte first to guard against such race
>> or swp_type would be unexpected. But the
On 2021/4/19 10:48, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> We will use percpu-refcount to serialize against concurrent swapoff. This
>> patch adds the percpu_ref support for swap.
>>
>> Signed-off-by: Miaohe Lin
>> ---
>> include/linux/swa
be found in the respective
changelogs. Thanks!
v1->v2:
reorganize the patch-2/5
various enhance and fixup per Huang, Ying
Many thanks for the comments of Huang, Ying, Dennis Zhou and Tim Chen.
Miaohe Lin (5):
mm/swapfile: add percpu_ref support for swap
mm/swapfile: use percpu_ref
ynchronize_rcu();
..
si->swap_file = NULL;
struct inode *inode = si->swap_file->f_mapping->host;[oops!]
Close this race window by using get/put_swap_device() to guard against
concurrent swapoff.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2"
wap: skip swapcache for swapin of synchronous device")
Reported-by: kernel test robot (auto build test ERROR)
Signed-off-by: Miaohe Lin
---
include/linux/swap.h | 9 +
mm/memory.c | 9 +
2 files changed, 18 insertions(+)
diff --git a/include/linux/swap.h b/include/linux/s
Use percpu_ref to serialize against concurrent swapoff. Also remove the
SWP_VALID flag because it's used together with RCU solution.
Signed-off-by: Miaohe Lin
---
include/linux/swap.h | 3 +--
mm/swapfile.c| 43 +--
2 files changed, 18 inser
TE
entries later. So checking for non_swap_entry() is not really needed here
and should be removed to avoid confusion.
Signed-off-by: Miaohe Lin
---
mm/swap_state.c | 6 --
1 file changed, 6 deletions(-)
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 272ea2108c9d..df5405384520 10064
We will use percpu-refcount to serialize against concurrent swapoff. This
patch adds the percpu_ref support for swap.
Signed-off-by: Miaohe Lin
---
include/linux/swap.h | 3 +++
mm/swapfile.c| 33 +
2 files changed, 32 insertions(+), 4 deletions(-)
diff
On 2021/4/16 14:25, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/15 22:31, Dennis Zhou wrote:
>>> On Thu, Apr 15, 2021 at 01:24:31PM +0800, Huang, Ying wrote:
>>>> Dennis Zhou writes:
>>>>
>>>>> On Wed, Apr 14, 2021 at 01:
gt; On Wed, Apr 14, 2021 at 11:59:03AM +0800, Huang, Ying wrote:
>>>>>> Dennis Zhou writes:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> On Wed, Apr 14, 2021 at 10:06:48AM +0800, Huang, Ying wrote:
>>>>
On 2021/4/15 12:20, Dennis Zhou wrote:
> On Thu, Apr 15, 2021 at 11:16:42AM +0800, Miaohe Lin wrote:
>> On 2021/4/14 22:53, Dennis Zhou wrote:
>>> On Wed, Apr 14, 2021 at 01:44:58PM +0800, Huang, Ying wrote:
>>>> Dennis Zhou writes:
>>>>
>>>>&
On 2021/4/15 0:13, Tim Chen wrote:
>
>
> On 4/13/21 6:04 PM, Huang, Ying wrote:
>> Tim Chen writes:
>>
>>> On 4/12/21 6:27 PM, Huang, Ying wrote:
>>>
This isn't the commit that introduces the race. You can use `git blame`
find out the correct commit. For this it's commit 0bcac06
lo,
>>>>>
>>>>> On Wed, Apr 14, 2021 at 10:06:48AM +0800, Huang, Ying wrote:
>>>>>> Miaohe Lin writes:
>>>>>>
>>>>>>> On 2021/4/14 9:17, Huang, Ying wrote:
>>>>>>>> Miaohe Lin writes:
>
On 2021/4/14 11:07, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/13 9:27, Huang, Ying wrote:
>>> Miaohe Lin writes:
>>>
>>>> When I was investigating the swap code, I found the below possible race
>>>> window:
>
On 2021/4/13 9:27, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> When I was investigating the swap code, I found the below possible race
>> window:
>>
>> CPU 1CPU 2
>> ---
On 2021/4/13 9:36, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> swap_cluster_readahead() could race with swapoff and might dereference
>> si->swap_file after it's released by swapoff. Close this race window by
>> using get/put_swap_device() pair.
>
> I thin
On 2021/4/13 9:33, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> The function get_shadow_from_swap_cache() can race with swapoff, though
>> it's only called by do_swap_page() now.
>>
>> Fixes: aae466b0052e ("mm/swap: implement workingset detection for anon
On 2021/4/14 9:04, Huang, Ying wrote:
> Tim Chen writes:
>
>> On 4/12/21 6:27 PM, Huang, Ying wrote:
>>
>>>
>>> This isn't the commit that introduces the race. You can use `git blame`
>>> find out the correct commit. For this it's commit 0bcac06f27d7 "mm,
>>> swap: skip swapcache for swapin of
On 2021/4/14 9:17, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/12 15:24, Huang, Ying wrote:
>>> "Huang, Ying" writes:
>>>
>>>> Miaohe Lin writes:
>>>>
>>>>> We will use percpu-refcount to serialize aga
On 2021/4/12 15:24, Huang, Ying wrote:
> "Huang, Ying" writes:
>
>> Miaohe Lin writes:
>>
>>> We will use percpu-refcount to serialize against concurrent swapoff. This
>>> patch adds the percpu_ref support for later fixup.
>>>
>>&
On 2021/4/13 2:51, Mike Kravetz wrote:
> On 4/10/21 12:23 AM, Miaohe Lin wrote:
>> The local variable pseudo_vma is not used anymore.
>>
>> Signed-off-by: Miaohe Lin
>
> Thanks,
>
> That should have been removed with 1b426bac66e6 ("hugetlb: use same f
On 2021/4/12 11:30, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> We will use percpu-refcount to serialize against concurrent swapoff. This
>> patch adds the percpu_ref support for later fixup.
>>
>> Signed-off-by: Miaohe Lin
>> ---
>> include/linux/sw
On 2021/4/12 9:44, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/10 1:17, Tim Chen wrote:
>>>
>>>
>>> On 4/9/21 1:42 AM, Miaohe Lin wrote:
>>>> On 2021/4/9 5:34, Tim Chen wrote:
>>>>>
>>>>>
>>>>
On 2021/4/12 8:55, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/4/9 16:50, Huang, Ying wrote:
>>> Miaohe Lin writes:
>>>
>>>> While we released the pte lock, somebody else might faulted in this pte.
>>>> So we should check whether
On 2021/3/30 15:27, Yu Zhao wrote:
> On Tue, Mar 30, 2021 at 12:57 AM Huang, Ying wrote:
>>
>> Yu Zhao writes:
>>
>>> On Mon, Mar 29, 2021 at 9:44 PM Huang, Ying wrote:
>>>>
>>>> Miaohe Lin writes:
>>>>
>>>>>
On 2021/4/11 4:02, Yu Zhao wrote:
> On Sat, Apr 10, 2021 at 5:01 AM Miaohe Lin wrote:
>>
>> On 2021/4/10 18:42, Yu Zhao wrote:
>>> On Sat, Apr 10, 2021 at 1:30 AM Miaohe Lin wrote:
>>>>
>>>> Hi:
>>>> On 2021/4/5 18:20, Miaohe Lin wrote:
On 2021/4/10 18:42, Yu Zhao wrote:
> On Sat, Apr 10, 2021 at 1:30 AM Miaohe Lin wrote:
>>
>> Hi:
>> On 2021/4/5 18:20, Miaohe Lin wrote:
>>> frontswap_register_ops can race with swapon. Consider the following scene:
>>
>> Any comment or suggestion? Or
Hi:
On 2021/4/5 18:20, Miaohe Lin wrote:
> frontswap_register_ops can race with swapon. Consider the following scene:
Any comment or suggestion? Or is this race window too theoretical to fix?
Thanks.
>
> CPU1
The same VM_BUG_ON() check is already done in the callee. Remove this extra
one to simplify the code slightly.
Reviewed-by: Mike Kravetz
Signed-off-by: Miaohe Lin
---
mm/hugetlb.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index c22111f3da20..a03a50b7c410
these cases.
Fixes: b5cec28d36f5 ("hugetlbfs: truncate_hugepages() takes a range of pages")
Signed-off-by: Miaohe Lin
---
mm/hugetlb.c | 11 +--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 387c9a62615e..a14bb1a03ee4 10064
h the file. As a result, remove_inode_hugepages will never find any
huge pages associated with the inode and the passed value 'freed' will
always be zero."
Add a comment clarifying this to make it clear and also avoid confusion.
Signed-off-by: Miaohe Lin
---
mm/hugetlb.c |
the HPAGE_RESV_OWNER check per Mike
add a comment to hugetlb_unreserve_pages per Mike
expand warning message a bit for hugetlb_fix_reserve_counts
Add a new patch to remove unused variable
Many thanks for Mike's review and suggestion!
Miaohe Lin (5):
mm/hugeltb: remove redundant VM_BUG
The local variable pseudo_vma is not used anymore.
Signed-off-by: Miaohe Lin
---
fs/hugetlbfs/inode.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index d81f52b87bd7..a2a42335e8fd 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
more
clear.
Signed-off-by: Miaohe Lin
---
mm/hugetlb.c | 41 -
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index a03a50b7c410..9b4c05699a90 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2163,27 +2163,26 @@ s
On 2021/4/10 1:17, Tim Chen wrote:
>
>
> On 4/9/21 1:42 AM, Miaohe Lin wrote:
>> On 2021/4/9 5:34, Tim Chen wrote:
>>>
>>>
>>> On 4/8/21 6:08 AM, Miaohe Lin wrote:
>>>> When I was investigating the swap code, I foun
On 2021/4/9 16:50, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> While we released the pte lock, somebody else might faulted in this pte.
>> So we should check whether it's swap pte first to guard against such race
>> or swp_type would be unexpected. And we ca
On 2021/4/9 5:34, Tim Chen wrote:
>
>
> On 4/8/21 6:08 AM, Miaohe Lin wrote:
>> When I was investigating the swap code, I found the below possible race
>> window:
>>
>> CPU 1CPU 2
>> -
On 2021/4/8 22:55, riteshh wrote:
> On 21/04/08 09:08AM, Miaohe Lin wrote:
>> Hi all,
>> When I was investigating the swap code, I found some possible race
>> windows. This series aims to fix all these races. But using current
>> get/put_swap_device() to guard aga
On 2021/4/9 13:04, Andrew Morton wrote:
> On Fri, 9 Apr 2021 11:17:49 +0800 Miaohe Lin wrote:
>
>> On 2021/4/9 7:25, Mike Kravetz wrote:
>>> On 4/2/21 2:32 AM, Miaohe Lin wrote:
>>>> A rare out of memory error would prevent removal of the r
On 2021/4/9 12:37, Mike Kravetz wrote:
> On 4/8/21 8:01 PM, Miaohe Lin wrote:
>> On 2021/4/9 6:53, Mike Kravetz wrote:
>>>
>>> Yes, add a comment to hugetlb_unreserve_pages saying that !resv_map
>>> implies freed == 0.
>>>
>>
>> Sound
On 2021/4/9 7:25, Mike Kravetz wrote:
> On 4/2/21 2:32 AM, Miaohe Lin wrote:
>> A rare out of memory error would prevent removal of the reserve map region
>> for a page. hugetlb_fix_reserve_counts() handles this rare case to avoid
>> dangling with incorrect
On 2021/4/9 6:53, Mike Kravetz wrote:
> On 4/7/21 8:26 PM, Miaohe Lin wrote:
>> On 2021/4/8 11:24, Miaohe Lin wrote:
>>> On 2021/4/8 4:53, Mike Kravetz wrote:
>>>> On 4/7/21 12:24 AM, Miaohe Lin wrote:
>>>>> Hi:
>>>>> On 2021/4/7 10:
On 2021/4/9 6:40, Mike Kravetz wrote:
> On 4/7/21 7:44 PM, Miaohe Lin wrote:
>> On 2021/4/8 5:23, Mike Kravetz wrote:
>>> On 4/6/21 8:09 PM, Miaohe Lin wrote:
>>>> On 2021/4/7 10:37, Mike Kravetz wrote:
>>>>> On 4/6/21 7:05 PM, Miaohe Lin wrote:
>
The function get_shadow_from_swap_cache() can race with swapoff, though
it's only called by do_swap_page() now.
Fixes: aae466b0052e ("mm/swap: implement workingset detection for anonymous
LRU")
Signed-off-by: Miaohe Lin
---
mm/swap_state.c | 9 ++---
1 file changed, 6 i
s race window(as suggested by Huang, Ying).
Fixes: 235b62176712 ("mm/swap: add cluster lock")
Signed-off-by: Miaohe Lin
---
include/linux/swap.h | 2 +-
mm/memory.c | 10 ++
mm/swapfile.c| 28 +++-
3 files changed, 22 insertions(+), 18 de
We will use percpu-refcount to serialize against concurrent swapoff. This
patch adds the percpu_ref support for later fixup.
Signed-off-by: Miaohe Lin
---
include/linux/swap.h | 2 ++
mm/swapfile.c| 25 ++---
2 files changed, 24 insertions(+), 3 deletions(-)
diff
swap_cluster_readahead() could race with swapoff and might dereference
si->swap_file after it's released by swapoff. Close this race window by
using get/put_swap_device() pair.
Signed-off-by: Miaohe Lin
---
mm/swap_state.c | 11 +--
1 file changed, 9 insertions(+), 2 deletions(
based swap readahead")
Signed-off-by: Miaohe Lin
---
mm/swap_state.c | 13 +
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 709c260d644a..3bf0d0c297bc 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -724,10 +724,10
the respective changelogs.
Thanks!
Miaohe Lin (5):
mm/swapfile: add percpu_ref support for swap
swap: fix do_swap_page() race with swapoff
mm/swap_state: fix get_shadow_from_swap_cache() race with swapoff
mm/swap_state: fix potential faulted in race in swap_ra_info()
mm/swap_state: fix
On 2021/4/8 11:24, Miaohe Lin wrote:
> On 2021/4/8 4:53, Mike Kravetz wrote:
>> On 4/7/21 12:24 AM, Miaohe Lin wrote:
>>> Hi:
>>> On 2021/4/7 10:49, Mike Kravetz wrote:
>>>> On 4/2/21 2:32 AM, Miaohe Lin wrote:
>>>>> The resv_map could
On 2021/4/8 4:53, Mike Kravetz wrote:
> On 4/7/21 12:24 AM, Miaohe Lin wrote:
>> Hi:
>> On 2021/4/7 10:49, Mike Kravetz wrote:
>>> On 4/2/21 2:32 AM, Miaohe Lin wrote:
>>>> The resv_map could be NULL since this routine can be called in the evict
>>>
On 2021/4/8 5:23, Mike Kravetz wrote:
> On 4/6/21 8:09 PM, Miaohe Lin wrote:
>> On 2021/4/7 10:37, Mike Kravetz wrote:
>>> On 4/6/21 7:05 PM, Miaohe Lin wrote:
>>>> Hi:
>>>> On 2021/4/7 8:53, Mike Kravetz wrote:
>>>>> On 4/2/21 2:32 AM,
Hi:
On 2021/4/7 10:49, Mike Kravetz wrote:
> On 4/2/21 2:32 AM, Miaohe Lin wrote:
>> The resv_map could be NULL since this routine can be called in the evict
>> inode path for all hugetlbfs inodes. So we could have chg = 0 and this
>> would result in a negative value when
On 2021/4/7 10:37, Mike Kravetz wrote:
> On 4/6/21 7:05 PM, Miaohe Lin wrote:
>> Hi:
>> On 2021/4/7 8:53, Mike Kravetz wrote:
>>> On 4/2/21 2:32 AM, Miaohe Lin wrote:
>>>> It's guaranteed that the vma is associated with a resv_map, i.e. either
>>&g
Hi:
On 2021/4/7 8:53, Mike Kravetz wrote:
> On 4/2/21 2:32 AM, Miaohe Lin wrote:
>> It's guaranteed that the vma is associated with a resv_map, i.e. either
>> VM_MAYSHARE or HPAGE_RESV_OWNER, when the code reaches here or we would
>> have returned via !resv check above.
frontswap
is uninitialized yet. Fix all these by using swapon_mutex to guard against
race with swapon and add swap_info_get_if_under_swapoff() to collect swap
devices under swapoff.
Fixes: d1dc6f1bcf1e ("frontswap: allow multiple backends")
Signed-off-by: Miaohe Lin
---
include/linux/
("hugetlbfs: truncate_hugepages() takes a range of pages")
Signed-off-by: Miaohe Lin
---
mm/hugetlb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index b7864abded3d..bdff8d23803f 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5413
these cases.
Fixes: b5cec28d36f5 ("hugetlbfs: truncate_hugepages() takes a range of pages")
Signed-off-by: Miaohe Lin
---
mm/hugetlb.c | 11 +--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index bdff8d23803f..ca5464ed04b7 10064
The same VM_BUG_ON() check is already done in the callee. Remove this extra
one to simplify the code slightly.
Signed-off-by: Miaohe Lin
---
mm/hugetlb.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index c22111f3da20..a03a50b7c410 100644
--- a/mm/hugetlb.c
It's guaranteed that the vma is associated with a resv_map, i.e. either
VM_MAYSHARE or HPAGE_RESV_OWNER, when the code reaches here or we would
have returned via !resv check above. So ret must be less than 0 in the
'else' case. Simplify the return code to make this clear.
Signed
Hi all,
This series contains cleanups to remove redundant VM_BUG_ON() and
simplify the return code. Also this fixes potential wrong gbl_reserve
value and handle the error case in hugetlb_fix_reserve_counts(). More
details can be found in the respective changelogs. Thanks!
Miaohe Lin (4):
mm
On 2021/4/1 11:35, Roman Gushchin wrote:
> On Thu, Apr 01, 2021 at 11:31:16AM +0800, Miaohe Lin wrote:
>> On 2021/4/1 11:01, Muchun Song wrote:
>>> Christian Borntraeger reported a warning about "percpu ref
>>> (obj_cgroup_release) <= 0 (-1) after switching t
On 2021/4/1 11:01, Muchun Song wrote:
> Christian Borntraeger reported a warning about "percpu ref
> (obj_cgroup_release) <= 0 (-1) after switching to atomic".
> Because we forgot to obtain the reference to the objcg and
> wrongly obtain the reference of memcg.
>
> Reported-by: Christian Borntraeg
The macro KSM_FLAG_MASK is used in rmap_walk_ksm() only. So we can replace
~KSM_FLAG_MASK with PAGE_MASK to remove this dedicated macro and make code
more consistent because PAGE_MASK is used elsewhere in this file.
Signed-off-by: Miaohe Lin
---
mm/ksm.c | 4 +---
1 file changed, 1 insertion
The same VM_BUG_ON_PAGE() check is already done in the callee. Remove these
extra caller one to simplify code slightly.
Signed-off-by: Miaohe Lin
---
mm/ksm.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/ksm.c b/mm/ksm.c
index 1f2c62e1d797..359afb3023b4 100644
--- a/mm/ksm.c
+++ b/mm
amp;& rmap_item->head == stable_node
return;
We would miss the rmap_item for stable_node and might result in failed
rmap_walk_ksm(). Fix this by set rmap_item->head to NULL when rmap_item
is removed from stable tree.
Fixes: 4146d2d673e8 ("ksm: make !merge_across_nodes migration safe")
Sig
It's unnecessary to lock the page when get ksm page if we're going to
remove the rmap item as page migration is irrelevant in this case. Use
GET_KSM_PAGE_NOLOCK instead to save some page lock cycles.
Signed-off-by: Miaohe Lin
---
mm/ksm.c | 3 +--
1 file changed, 1 insertion(+), 2
Hi all,
This series contains cleanups to remove unnecessary VM_BUG_ON_PAGE and
dedicated macro KSM_FLAG_MASK. Also this fixes potential missing rmap_item
for stable_node which would result in failed rmap_walk_ksm(). More details
can be found in the respective changelogs. Thanks!
Miaohe Lin (4
On 2021/3/30 11:44, Huang, Ying wrote:
> Miaohe Lin writes:
>
>> On 2021/3/30 9:57, Huang, Ying wrote:
>>> Hi, Miaohe,
>>>
>>> Miaohe Lin writes:
>>>
>>>> Hi all,
>>>> I am investigating the swap
On 2021/3/30 9:57, Huang, Ying wrote:
> Hi, Miaohe,
>
> Miaohe Lin writes:
>
>> Hi all,
>> I am investigating the swap code, and I found the below possible race window:
>>
>> CPU 1
by: Michal Hocko
> Reviewed-by: Muchun Song
Looks good to me. Thanks!
Reviewed-by: Miaohe Lin
> ---
> mm/hugetlb.c | 32 +++-
> 1 file changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 16bea
Hi all,
I am investigating the swap code, and I found the below possible race window:
CPU 1 CPU 2
- -
do_swap_page
skip swapcache case (synchronous swap_readpage)
alloc_page_vma
On 2021/3/27 3:57, Mike Kravetz wrote:
> On 3/25/21 7:10 PM, Miaohe Lin wrote:
>> On 2021/3/25 8:28, Mike Kravetz wrote:
>>> The new remove_hugetlb_page() routine is designed to remove a hugetlb
>>> page from hugetlbfs processing. It will remove the page from the acti
On 2021/3/25 8:28, Mike Kravetz wrote:
> After making hugetlb lock irq safe and separating some functionality
> done under the lock, add some lockdep_assert_held to help verify
> locking.
>
Looks good to me. Thanks.
Reviewed-by: Miaohe Lin
> Signed-off-by: Mike Kravetz
> -
e used in routines
> + *which operate on the resulting compound page.
It seems HPageFreed and HPageTemporary is cleared. Which hugetlb specific page
flags
is reserverd here and why? Could you please give a simple example to clarify
this in the comment to help understand this NOT
; + struct mutex mutex;
I am also with Michal and Oscar here, renaming the mutex to something closer to
its function.
Reviewed-by: Miaohe Lin
> int next_nid_to_alloc;
> int next_nid_to_free;
> unsigned int order;
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
&
Hi:
On 2021/3/25 8:28, Mike Kravetz wrote:
> This effort is the result a recent bug report [1]. In subsequent
> discussions [2], it was deemed necessary to properly fix the hugetlb
Many thanks for the effort. I have read the discussions and it is pretty long.
Maybe it would be helpful if you give
Hi all,
This series contains cleanups to remove unnecessary out label and
meaningless !pte_present() check. Also use helper function to simplify
the code. More details can be found in the respective changelogs.
Thanks!
Miaohe Lin (3):
khugepaged: use helper function range_in_vma() in
We know it must meet the !is_swap_pte() and !pte_none() condition if we
reach here. Since !is_swap_pte() indicates pte_none() or pte_present()
is met, it's guaranteed that pte must be present here.
Signed-off-by: Miaohe Lin
---
mm/khugepaged.c | 4
1 file changed, 4 deletions(-)
The out label here is unneeded because it just goes to out_up_write label.
Remove it to make code more concise.
Signed-off-by: Miaohe Lin
---
mm/khugepaged.c | 8 +++-
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index ad0444f3f487
We could use helper function range_in_vma() to check whether the desired
range is inside the vma to simplify the code.
Signed-off-by: Miaohe Lin
---
mm/khugepaged.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index b81521dfbb1a
The putback_movable_page() is just called by putback_movable_pages() and
we know the page is locked and both PageMovable() and PageIsolated() is
checked right before calling putback_movable_page(). So we make it static
and remove all the 3 VM_BUG_ON_PAGE().
Signed-off-by: Miaohe Lin
---
include
verlooked this in the first
place."
Reviewed-by: Yang Shi
Signed-off-by: Miaohe Lin
---
mm/migrate.c | 18 ++
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index c621c8f6fb7d..51190759e6dd 100644
--- a/mm/migrate.c
+++ b/
It's more recommended to use helper function migrate_vma_collect_skip() to
skip the unexpected case and it also helps remove some duplicated codes.
Move migrate_vma_collect_skip() above migrate_vma_collect_hole() to avoid
compiler warning.
Reviewed-by: David Hildenbrand
Signed-off-by: Miaoh
It's guaranteed that in the 'else' case of the rc == MIGRATEPAGE_SUCCESS
check, rc does not equal to MIGRATEPAGE_SUCCESS. Remove this unnecessary
check.
Reviewed-by: David Hildenbrand
Reviewed-by: Yang Shi
Signed-off-by: Miaohe Lin
---
mm/migrate.c | 2 +-
1 file changed, 1
1 - 100 of 434 matches
Mail list logo