Re: [linus:master] [mm] d99e3140a4: BUG:KCSAN:data-race_in_folio_remove_rmap_ptes/print_report

2024-05-28 Thread Miaohe Lin
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. .

[PATCH v3 3/4] mm/swap: remove confusing checking for non_swap_entry() in swap_ra_info()

2021-04-20 Thread Miaohe Lin
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

[PATCH v3 1/4] mm/swapfile: use percpu_ref to serialize against concurrent swapoff

2021-04-20 Thread Miaohe Lin
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

[PATCH v3 4/4] mm/shmem: fix shmem_swapin() race with swapoff

2021-04-20 Thread Miaohe Lin
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

[PATCH v3 0/4] close various race windows for swap

2021-04-20 Thread Miaohe Lin
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/

[PATCH v3 2/4] swap: fix do_swap_page() race with swapoff

2021-04-20 Thread Miaohe Lin
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

[PATCH] memory tier: rename destroy_memory_type() to put_memory_type()

2023-07-05 Thread Miaohe Lin
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/

Re: [PATCH] memory tier: rename destroy_memory_type() to put_memory_type()

2023-07-06 Thread Miaohe Lin
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(). >&

Re: [PATCH 2/4] mm/hugeltb: simplify the return code of __vma_reservation_common()

2021-04-07 Thread Miaohe Lin
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,

Re: [PATCH 3/4] mm/hugeltb: fix potential wrong gbl_reserve value for hugetlb_acct_memory()

2021-04-07 Thread Miaohe Lin
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 >>>

Re: [PATCH 3/4] mm/hugeltb: fix potential wrong gbl_reserve value for hugetlb_acct_memory()

2021-04-07 Thread Miaohe Lin
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

[PATCH 0/5] close various race windows for swap

2021-04-08 Thread Miaohe Lin
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

[PATCH 1/5] mm/swapfile: add percpu_ref support for swap

2021-04-08 Thread Miaohe Lin
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

[PATCH 5/5] mm/swap_state: fix swap_cluster_readahead() race with swapoff

2021-04-08 Thread Miaohe Lin
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(

[PATCH 2/5] swap: fix do_swap_page() race with swapoff

2021-04-08 Thread Miaohe Lin
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

[PATCH 4/5] mm/swap_state: fix potential faulted in race in swap_ra_info()

2021-04-08 Thread Miaohe Lin
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

[PATCH 3/5] mm/swap_state: fix get_shadow_from_swap_cache() race with swapoff

2021-04-08 Thread Miaohe Lin
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

Re: [PATCH 2/4] mm/hugeltb: simplify the return code of __vma_reservation_common()

2021-04-08 Thread Miaohe Lin
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: >

Re: [PATCH 3/4] mm/hugeltb: fix potential wrong gbl_reserve value for hugetlb_acct_memory()

2021-04-08 Thread Miaohe Lin
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:

Re: [PATCH 4/4] mm/hugeltb: handle the error case in hugetlb_fix_reserve_counts()

2021-04-08 Thread Miaohe Lin
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

Re: [PATCH 3/4] mm/hugeltb: fix potential wrong gbl_reserve value for hugetlb_acct_memory()

2021-04-08 Thread Miaohe Lin
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

Re: [PATCH 4/4] mm/hugeltb: handle the error case in hugetlb_fix_reserve_counts()

2021-04-09 Thread Miaohe Lin
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

Re: [PATCH 0/5] close various race windows for swap

2021-04-09 Thread Miaohe Lin
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

Re: [PATCH 2/5] swap: fix do_swap_page() race with swapoff

2021-04-09 Thread Miaohe Lin
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 >> -

Re: [PATCH 4/5] mm/swap_state: fix potential faulted in race in swap_ra_info()

2021-04-09 Thread Miaohe Lin
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

Re: [PATCH RFC] hugetlb_cgroup: fix unbalanced css_put for shared mappings

2021-02-09 Thread Miaohe Lin
Hi: On 2021/2/10 2:56, Mike Kravetz wrote: > On 2/8/21 7:27 PM, Miaohe Lin wrote: >> On 2021/2/9 3:52, Mike Kravetz wrote: >>> On 1/23/21 1:31 AM, Miaohe Lin wrote: >>>> The current implementation of hugetlb_cgroup for shared mappings could have >>>> diff

[PATCH] mm/hugetlb: use some helper functions to cleanup code

2021-02-09 Thread Miaohe Lin
We could use pages_per_huge_page to get the number of pages per hugepage, use get_hstate_idx to calculate hstate index, and use hstate_is_gigantic to check if a hstate is gigantic to make code more succinct. Signed-off-by: Miaohe Lin --- fs/hugetlbfs/inode.c | 2 +- mm/hugetlb.c | 6

[PATCH] mm/hugetlb: optimize the surplus state transfer code in move_hugetlb_state()

2021-02-09 Thread Miaohe Lin
We should not transfer the per-node surplus state when we do not cross the node in order to save some cpu cycles Signed-off-by: Miaohe Lin --- mm/hugetlb.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index da347047ea10..4f2c92ddbca4 100644 --- a/mm

[PATCH] mm/huge_memory.c: Remove unnecessary local variable ret2

2021-02-09 Thread Miaohe Lin
There is no need to use a new local variable ret2 to get the return value of handle_userfault(). Use ret directly to make code more succinct. Signed-off-by: Miaohe Lin --- mm/huge_memory.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/huge_memory.c b/mm

[PATCH] mm/hugetlb: remove redundant reservation check condition in alloc_huge_page()

2021-02-09 Thread Miaohe Lin
If there is no reservation corresponding to a vma, map_chg is always != 0, i.e. we can not meet the condition where a vma does not have reservation while map_chg = 0. Signed-off-by: Miaohe Lin --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm

Re: [PATCH] mm/hugetlb: use some helper functions to cleanup code

2021-02-10 Thread Miaohe Lin
On 2021/2/10 16:35, David Hildenbrand wrote: > On 10.02.21 07:53, Miaohe Lin wrote: >> We could use pages_per_huge_page to get the number of pages per hugepage, >> use get_hstate_idx to calculate hstate index, and use hstate_is_gigantic >> to check if a hstate is gigan

[PATCH] hugetlb_cgroup: fix imbalanced css_get and css_put pair for shared mappings

2021-02-10 Thread Miaohe Lin
for each file_region and release the reference held by caller when they are done. Fixes: 075a61d07a8e ("hugetlb_cgroup: add accounting for shared mappings") Signed-off-by: Shijie Luo Signed-off-by: Miaohe Lin Cc: sta...@kernel.org --- The Spring Festival is coming. It's the ye

Re: [PATCH] mm/hugetlb: remove redundant reservation check condition in alloc_huge_page()

2021-02-17 Thread Miaohe Lin
Hi: On 2021/2/13 9:15, Mike Kravetz wrote: > On 2/9/21 11:54 PM, Miaohe Lin wrote: >> If there is no reservation corresponding to a vma, map_chg is always != 0, >> i.e. we can not meet the condition where a vma does not have reservation >> while map_chg = 0. > > T

Re: [PATCH 1/2] mm: replace BUG_ON in vm_insert_page with a return of an error

2021-02-02 Thread Miaohe Lin
ication of an error without panicing the kernel. > This will help identifying drivers that need to clear VM_PFNMAP before > using dmabuf system heap which is moving to use vm_insert_page. > > Suggested-by: Christoph Hellwig > Signed-off-by: Suren Baghdasaryan Looks reasonabl

Re: [PATCH] wireless: fix typo issue

2021-02-02 Thread Miaohe Lin
On 2021/2/3 15:33, Johannes Berg wrote: > On Wed, 2021-02-03 at 15:00 +0800, samirweng1979 wrote: >> From: wengjianfeng >> >> change 'iff' to 'if'. >> >> Signed-off-by: wengjianfeng >> --- >> net/wireless/chan.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/net/wire

[PATCH] mm/pgtable-generic.c: optimize the VM_BUG_ON condition in pmdp_huge_clear_flush()

2021-02-03 Thread Miaohe Lin
conditions. Suggested-by: Andrew Morton Signed-off-by: Miaohe Lin --- mm/pgtable-generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index fa1375f3e3b2..c2210e1cdb51 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c

[PATCH] mm: Remove unused return value of set_huge_zero_page()

2021-02-03 Thread Miaohe Lin
The return value of set_huge_zero_page() is always ignored. So we should drop such return value. Signed-off-by: Miaohe Lin --- mm/huge_memory.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 987cf5e4cf90..360b689bd66a 100644

[PATCH] mm/zsmalloc.c: use page_private() to access page->private

2021-02-03 Thread Miaohe Lin
It's recommended to use helper macro page_private() to access the private field of page. Use such helper to eliminate direct access. Signed-off-by: Miaohe Lin --- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index cf0ed0e

[PATCH] mm/rmap: Correct obsolete comment of page_get_anon_vma()

2021-02-03 Thread Miaohe Lin
Since commit 746b18d421da ("mm: use refcounts for page_lock_anon_vma()"), page_lock_anon_vma() is renamed to page_get_anon_vma() and converted to return a refcount increased anon_vma. But it forgot to change the relevant comment. Signed-off-by: Miaohe Lin --- mm/rmap.c | 4 ++-- 1 fi

[PATCH] mm/mempolicy: use helper range_in_vma() in queue_pages_test_walk()

2021-01-30 Thread Miaohe Lin
The helper range_in_vma() is introduced via commit 017b1660df89 ("mm: migration: fix migration of huge PMD shared pages"). But we forgot to use it in queue_pages_test_walk(). Signed-off-by: Miaohe Lin --- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] mm/rmap: use page_not_mapped in try_to_unmap()

2021-01-30 Thread Miaohe Lin
move page_not_mapped() above try_to_unmap() to avoid identifier undeclared compilation error. Signed-off-by: Miaohe Lin --- mm/rmap.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index c3f6e060d73f..b49e85605f8f 100644 --- a/mm/rmap.c +++

[PATCH] hugetlbfs: show pagesize in unit of GB if possible

2021-01-30 Thread Miaohe Lin
Hugepage size in unit of GB is supported. We could show pagesize in unit of GB to make it more friendly to read. Also rework the calculation code of page size unit to make it more readable. Signed-off-by: Miaohe Lin --- fs/hugetlbfs/inode.c | 12 1 file changed, 8 insertions(+), 4

[PATCH] hugetlbfs: fix some comment typos

2021-01-30 Thread Miaohe Lin
Fix typos reserv to reserve, minimim to minimum. No functional change intended. Signed-off-by: Miaohe Lin --- fs/hugetlbfs/inode.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 40a9795f250a..db6504b5e89f 100644

Re: [PATCH] hugetlbfs: show pagesize in unit of GB if possible

2021-01-31 Thread Miaohe Lin
Hi: On 2021/1/31 6:07, David Rientjes wrote: > On Sat, 30 Jan 2021, Miaohe Lin wrote: > >> Hugepage size in unit of GB is supported. We could show pagesize in unit of >> GB to make it more friendly to read. Also rework the calculation code of >> page size unit

[PATCH] hugetlbfs: rework calculation code of Hugepage size in hugetlbfs_show_options()

2021-02-01 Thread Miaohe Lin
Rework calculation code of the Hugepage size to make it more readable and straightforward. Signed-off-by: Miaohe Lin --- fs/hugetlbfs/inode.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 3a08fbae3b53..1be18de4b537

[PATCH] mm/huge_memory.c: use helper range_in_vma() in __split_huge_p[u|m]d_locked()

2021-02-01 Thread Miaohe Lin
The helper range_in_vma() is introduced via commit 017b1660df89 ("mm: migration: fix migration of huge PMD shared pages"). But we forgot to use it in __split_huge_pud_locked() and __split_huge_pmd_locked(). Signed-off-by: Miaohe Lin --- mm/huge_memory.c | 6 ++ 1 file changed, 2

Re: [PATCH] hugetlbfs: rework calculation code of Hugepage size in hugetlbfs_show_options()

2021-02-01 Thread Miaohe Lin
Hi: On 2021/2/1 18:56, David Hildenbrand wrote: > On 01.02.21 09:23, Miaohe Lin wrote: >> Rework calculation code of the Hugepage size to make it more readable and >> straightforward. >> >> Signed-off-by: Miaohe Lin >> --- >>   fs/hugetlbfs/inode.c | 9

[PATCH] mm: simplify the VM_BUG_ON condition in pmdp_huge_clear_flush()

2021-02-01 Thread Miaohe Lin
The condition (A && !C && !D) || !A is equivalent to !A || (A && !C && !D) and can be further simplified to !A || (!C && !D). Signed-off-by: Miaohe Lin --- mm/pgtable-generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/

Re: [PATCH] hugetlbfs: show pagesize in unit of GB if possible

2021-02-01 Thread Miaohe Lin
Hi: On 2021/2/2 5:31, David Rientjes wrote: > On Mon, 1 Feb 2021, Miaohe Lin wrote: > >>>> Hugepage size in unit of GB is supported. We could show pagesize in unit of >>>> GB to make it more friendly to read. Also rework the calculation code of >>>&g

Re: [PATCH] mm/huge_memory.c: use helper range_in_vma() in __split_huge_p[u|m]d_locked()

2021-02-01 Thread Miaohe Lin
On 2021/2/2 5:27, David Rientjes wrote: > On Mon, 1 Feb 2021, Miaohe Lin wrote: > >> The helper range_in_vma() is introduced via commit 017b1660df89 ("mm: >> migration: fix migration of huge PMD shared pages"). But we forgot to >> use it in __split_huge_pud_lo

Re: [PATCH] mm/swap_state: Constify static struct attribute_group

2021-02-01 Thread Miaohe Lin
rn Looks good to me. Thanks. Reviewed-by: Miaohe Lin > --- > mm/swap_state.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/swap_state.c b/mm/swap_state.c > index d0d417efeecc..3cdee7b11da9 100644 > --- a/mm/swap_state.c > +++ b/mm/swap_stat

Re: [PATCH] mm: simplify the VM_BUG_ON condition in pmdp_huge_clear_flush()

2021-02-01 Thread Miaohe Lin
Hi: On 2021/2/2 7:33, Andrew Morton wrote: > On Mon, 1 Feb 2021 06:43:19 -0500 Miaohe Lin wrote: > >> The condition (A && !C && !D) || !A is equivalent to !A || (A && !C && !D) >> and can be further simplified to !A || (!C && !D). >

Re: [PATCH] mm/page_io: Use pr_alert_ratelimited for swap read/write errors

2021-02-01 Thread Miaohe Lin
> For example, on a systems using zram as swap, we are more likely to > see any page allocation errors preceding the swap write errors if the > alerts are ratelimited. > > Signed-off-by: Georgi Djakov Make sense for me. Thanks. Reviewed-by: Miaohe Lin > --- > mm/page_io.c

Re: mm/hugetlb.c: Fix typos in comments

2021-02-02 Thread Miaohe Lin
On 2021/2/2 16:34, Zhiyuan Dai wrote: > Signed-off-by: Zhiyuan Dai No patch description ? > --- > mm/hugetlb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 18f6ee3..35db386 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -39

Re: [PATCH 1/4] hugetlb: Dedup the code to add a new file_region

2021-02-03 Thread Miaohe Lin
viewed-by: Miaohe Lin > Signed-off-by: Peter Xu > --- > mm/hugetlb.c | 51 +++ > 1 file changed, 27 insertions(+), 24 deletions(-) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 18f6ee317900..d2859c2aecc9 100644 &

Re: [PATCH 2/4] hugetlg: Break earlier in add_reservation_in_range() when we can

2021-02-03 Thread Miaohe Lin
since the old code should still run > okay iiuc), but we'd better still touch it up to make it logically sane. > I think the difference is when we handle the rg->from == t case. Previous one is in the loop, now below the loop. But the result should be same. Thanks. Reviewed-by: Miao

Re: [PATCH v14 8/8] mm: hugetlb: optimize the code with the help of the compiler

2021-02-03 Thread Miaohe Lin
er. > > Signed-off-by: Muchun Song I like it. Thanks. Reviewed-by: Miaohe Lin > --- > include/linux/hugetlb.h | 3 ++- > mm/hugetlb_vmemmap.c| 13 + > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/include/linux/hugetlb.h b/include/linu

[PATCH] mm/mlock: stop counting mlocked pages when none vma is found

2021-02-04 Thread Miaohe Lin
There will be no vma satisfies addr < vm_end when find_vma() returns NULL. Thus it's meaningless to traverse the vma list below because we can't find any vma to count mlocked pages. Stop counting mlocked pages in this case to save some vma list traversal cycles. Signed-off-by: Miaohe

[PATCH] mm/hugetlb: Remove obsolete comment in vma_has_reserves()

2021-02-04 Thread Miaohe Lin
Shared mappings are allowed to be created without reservations since commit c37f9fb11c97 ("hugetlb: allow huge page mappings to be created without reservations"). Remove this obsolete comment which may cause confusing. Signed-off-by: Miaohe Lin --- mm/hugetlb.c | 1 - 1 file changed,

[PATCH] mm/hugetlb: use helper function range_in_vma() in page_table_shareable()

2021-02-04 Thread Miaohe Lin
We could use helper function range_in_vma() to check whether the vma is in the desired range to simplify the code. Signed-off-by: Miaohe Lin --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index cf82629319ed..442705be052a 100644

Re: [PATCH v14 2/8] mm: hugetlb: introduce a new config HUGETLB_PAGE_FREE_VMEMMAP

2021-02-04 Thread Miaohe Lin
-off-by: Muchun Song > Reviewed-by: Oscar Salvador > Acked-by: Mike Kravetz LGTM. Thanks. Reviewed-by: Miaohe Lin > --- > arch/x86/mm/init_64.c | 2 +- > fs/Kconfig| 6 ++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/mm/in

Re: [PATCH v2] mm: memcontrol: replace the loop with a list_for_each_entry()

2021-02-04 Thread Miaohe Lin
ch_entry(). > > There is only one caller of the uncharge_list(). So just fold it into > mem_cgroup_uncharge_list() and remove it. > > Signed-off-by: Muchun Song LGTM. Thanks. Reviewed-by: Miaohe Lin > --- > v2: > - Fold uncharge_list()

Re: [PATCH] mm/hugetlb: Remove obsolete comment in vma_has_reserves()

2021-02-04 Thread Miaohe Lin
Hi: On 2021/2/5 5:32, Mike Kravetz wrote: > On 2/4/21 3:15 AM, Miaohe Lin wrote: >> Shared mappings are allowed to be created without reservations since >> commit c37f9fb11c97 ("hugetlb: allow huge page mappings to be created >> without reservations"). Remove this o

Re: [PATCH] mm/rmap: Correct obsolete comment of page_get_anon_vma()

2021-02-04 Thread Miaohe Lin
Hi: On 2021/2/4 20:38, Matthew Wilcox wrote: > On Wed, Feb 03, 2021 at 04:32:15AM -0500, Miaohe Lin wrote: >> * Since there is no serialization what so ever against page_remove_rmap() >> - * the best this function can do is return a locked anon_vma that might >> - * have

Re: [PATCH] mm/pgtable-generic.c: optimize the VM_BUG_ON condition in pmdp_huge_clear_flush()

2021-02-04 Thread Miaohe Lin
Hi: On 2021/2/4 20:36, Matthew Wilcox wrote: > On Wed, Feb 03, 2021 at 03:41:37AM -0500, Miaohe Lin wrote: >> The developer will have trouble figuring out why the BUG actually triggered >> when there is a complex expression in the VM_BUG_ON. Because we can only >> identify th

Re: [PATCH v14 5/8] mm: hugetlb: add a kernel parameter hugetlb_free_vmemmap

2021-02-04 Thread Miaohe Lin
nabled. Because vmemmap_remap_free() depends on vmemmap > being base page mapped. > > Signed-off-by: Muchun Song > Reviewed-by: Oscar Salvador > Reviewed-by: Barry Song Looks good to me. Thanks. Reviewed-by: Miaohe Lin > --- > Documentation/admin-guide/kernel-parameters.txt | 14 +

Re: [PATCH v14 6/8] mm: hugetlb: introduce nr_free_vmemmap_pages in the struct hstate

2021-02-04 Thread Miaohe Lin
getlbpage.rst for more details. > + */ > + if (likely(vmemmap_pages > RESERVE_VMEMMAP_NR)) > + h->nr_free_vmemmap_pages = vmemmap_pages - RESERVE_VMEMMAP_NR; Not a problem. Should we set h->nr_free_vmemmap_pages to 0 in 'else' case explicit

Re: [PATCH v14 7/8] mm: hugetlb: gather discrete indexes of tail page

2021-02-04 Thread Miaohe Lin
GE_FREE_VMEMMAP, > so add a BUILD_BUG_ON to catch invalid usage of the tail struct page. > > Signed-off-by: Muchun Song > Reviewed-by: Oscar Salvador Thanks. Reviewed-by: Miaohe Lin > --- > include/linux/hugetlb.h| 20 ++-- > include/linux

[PATCH] mm/memory.c: fix potential pte_unmap_unlock pte error

2021-02-05 Thread Miaohe Lin
o_page_range() which applies a function to a pte range") Signed-off-by: Miaohe Lin --- mm/memory.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 9d68a2340589..b2d6a0a6088b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2394,

Re: [PATCH v14 6/8] mm: hugetlb: introduce nr_free_vmemmap_pages in the struct hstate

2021-02-05 Thread Miaohe Lin
Hi: On 2021/2/5 16:22, Oscar Salvador wrote: > On Fri, Feb 05, 2021 at 03:29:43PM +0800, Miaohe Lin wrote: >>> + if (likely(vmemmap_pages > RESERVE_VMEMMAP_NR)) >>> + h->nr_free_vmemmap_pages = vmemmap_pages - RESERVE_VMEMMAP_NR; >>

[PATCH] hugetlb_cgroup: use helper pages_per_huge_page() in hugetlb_cgroup

2021-02-05 Thread Miaohe Lin
We could use helper function pages_per_huge_page() to get the number of pages in a hstate to simplify the code slightly. Signed-off-by: Miaohe Lin --- mm/hugetlb_cgroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index

[PATCH] mm/arm64: Correct obsolete comment in do_page_fault()

2021-02-05 Thread Miaohe Lin
commit d8ed45c5dcd4 ("mmap locking API: use coccinelle to convert mmap_sem rwsem call sites") has convertd down_read_trylock() to mmap_read_trylock(). But it forgot to update the relevant comment. Signed-off-by: Miaohe Lin --- arch/arm64/mm/fault.c | 2 +- 1 file changed, 1 inser

Re: [PATCH v14 6/8] mm: hugetlb: introduce nr_free_vmemmap_pages in the struct hstate

2021-02-05 Thread Miaohe Lin
On 2021/2/5 16:56, Oscar Salvador wrote: > On Fri, Feb 05, 2021 at 04:39:26PM +0800, Miaohe Lin wrote: >> Hi: >> On 2021/2/5 16:22, Oscar Salvador wrote: >>> On Fri, Feb 05, 2021 at 03:29:43PM +0800, Miaohe Lin wrote: >>>>> + if (likely(vmemmap_pages &

[PATCH] mm/hugetlb: use helper huge_page_size() to simplify the hugetlb_vm_op_pagesize()

2021-02-05 Thread Miaohe Lin
We can use helper huge_page_size() to get the size of the pages allocated when backing a VMA directly to make the code more simplified. Signed-off-by: Miaohe Lin --- mm/hugetlb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index

Re: [PATCH v3 1/3] mm, slub: use pGp to print page flags

2021-02-08 Thread Miaohe Lin
: David Rientjes > Acked-by: Christoph Lameter > Signed-off-by: Yafang Shao LGTM. Thanks. Reviewed-by: Miaohe Lin > --- > mm/slub.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 34dcc09e2ec9..87ff086e68a

Re: [PATCH v3 2/3] mm, slub: don't combine pr_err with INFO

2021-02-08 Thread Miaohe Lin
-0c36-ebdd-2bc684c5a...@redhat.com/#t > > Suggested-by: Vlastimil Babka > Cc: David Hildenbrand > Signed-off-by: Yafang Shao Looks good,thanks. Reviewed-by: Miaohe Lin > --- > mm/slub.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff -

Re: [PATCH] mm/hugetlb: use helper huge_page_size() to get hugepage size

2021-02-08 Thread Miaohe Lin
Hi: On 2021/2/9 8:45, Mike Kravetz wrote: > On 2/8/21 12:24 AM, Miaohe Lin wrote: >> We can use helper huge_page_size() to get the hugepage size directly to >> simplify the code slightly. >> >> Signed-off-by: Miaohe Lin >> --- >> mm/hugetlb.c | 14 ++--

Re: [PATCH] mm/hugetlb: use helper huge_page_size() to get hugepage size

2021-02-08 Thread Miaohe Lin
On 2021/2/9 9:36, Mike Kravetz wrote: > On 2/8/21 5:24 PM, Miaohe Lin wrote: >> Hi: >> On 2021/2/9 8:45, Mike Kravetz wrote: >>> On 2/8/21 12:24 AM, Miaohe Lin wrote: >>>> We can use helper huge_page_size() to get the hugepage size directly to >>>>

Re: [PATCH] mm/hugetlb: Remove redundant VM_BUG_ON_PAGE on putback_active_hugepage()

2021-02-08 Thread Miaohe Lin
Hi: On 2021/2/9 9:26, Mike Kravetz wrote: > On 2/8/21 12:37 AM, Miaohe Lin wrote: >> PageHead(page) is implicitly checked in set_page_huge_active() via the >> PageHeadHuge(page) check. So remove this explicit one. > > I do not disagree with the code change. However, this co

[PATCH v2] mm/hugetlb: use helper huge_page_size() to get hugepage size

2021-02-08 Thread Miaohe Lin
We can use helper huge_page_size() to get the hugepage size directly to simplify the code slightly. Reviewed-by: Mike Kravetz Signed-off-by: Miaohe Lin --- v1 -> v2 change huge_page_size(h) >> 10 to huge_page_size(h) / SZ_1K collect Reviewed-by tag --- mm/huget

Re: [PATCH RFC] hugetlb_cgroup: fix unbalanced css_put for shared mappings

2021-02-08 Thread Miaohe Lin
On 2021/2/9 3:52, Mike Kravetz wrote: > On 1/23/21 1:31 AM, Miaohe Lin wrote: >> The current implementation of hugetlb_cgroup for shared mappings could have >> different behavior. Consider the following two scenarios: >> >> 1.Assume initial css reference count of hugetlb

Re: [PATCH] mm/hugetlb: Remove redundant VM_BUG_ON_PAGE on putback_active_hugepage()

2021-02-08 Thread Miaohe Lin
Hi: On 2021/2/9 11:39, Mike Kravetz wrote: > On 2/8/21 6:10 PM, Miaohe Lin wrote: >> Hi: >> On 2021/2/9 9:26, Mike Kravetz wrote: >>> On 2/8/21 12:37 AM, Miaohe Lin wrote: >>>> PageHead(page) is implicitly checked in set_page_huge_active() via the >>&

[PATCH v2] mm/hugetlb: Remove unnecessary VM_BUG_ON_PAGE on putback_active_hugepage()

2021-02-08 Thread Miaohe Lin
All callers know they are operating on a hugetlb head page. So this VM_BUG_ON_PAGE can not catch anything useful. 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 06719fdf9fd6..cfa06fd1b8d7 100644 --- a/mm/hugetlb.c

[PATCH v2] nfsd: Convert to use the preferred fallthrough macro

2020-08-19 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Please see commit 294f69e662d1 ("compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use") for detail. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/nfsd/nfs4callback.c | 2 +-

[PATCH] xfs: Convert to use the preferred fallthrough macro

2020-08-20 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Please see commit 294f69e662d1 ("compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use") for detail. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/xfs/libxfs/xfs_ag_resv

[PATCH] nfs: Convert to use the preferred fallthrough macro

2020-08-20 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Please see commit 294f69e662d1 ("compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use") for detail. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/nfs/blocklayout/bloc

[PATCH] net: Check the expect of skb->data at mac header

2020-08-20 Thread Miaohe Lin
skb_mpls_push() and skb_mpls_pop() expect skb->data at mac header. Check this assumption or we would get wrong mac_header and network_header. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 8 1 file changed, 8 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c in

[PATCH] net: Fix potential memory leak in proto_register()

2020-08-10 Thread Miaohe Lin
t;) Signed-off-by: Miaohe Lin --- net/core/sock.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 49cd5ffe673e..c9083ad44ea1 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3406,6 +3406,16 @@ s

[PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-10 Thread Miaohe Lin
The skb_shared_info part of the data is assigned in the following loop. It is meaningless to do a memcpy here. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 7e2e502ef519..5b983c9472f5 100644

[PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5

2020-08-18 Thread Miaohe Lin
We can possibly avoid strcmp warncomm with current->comm by check warned first. Signed-off-by: Miaohe Lin --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index e4f40b175acb..51e13bc42791 100644 --- a/net/core/sock.c ++

[PATCH] net: Relax the npages test against MAX_SKB_FRAGS

2020-08-18 Thread Miaohe Lin
The npages test against MAX_SKB_FRAGS can be relaxed if we succeed to allocate high order pages as the note in comment said. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c

[PATCH] net: tipc: Convert to use the preferred fallthrough macro

2020-08-18 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Miaohe Lin --- net/tipc/bearer.c | 2 +- net/tipc/link.c | 2 +- net/tipc/socket.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 808b147df7d5

[PATCH] libceph: Convert to use the preferred fallthrough macro

2020-08-18 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Miaohe Lin --- net/ceph/ceph_hash.c| 20 ++-- net/ceph/crush/mapper.c | 2 +- net/ceph/messenger.c| 4 ++-- net/ceph/mon_client.c | 2 +- net/ceph/osd_client.c | 4 ++-- 5 files changed

[PATCH v2] net: Stop warning about SO_BSDCOMPAT usage

2020-08-19 Thread Miaohe Lin
We've been warning about SO_BSDCOMPAT usage for many years. We may remove this code completely now. Suggested-by: David S. Miller Signed-off-by: Miaohe Lin --- net/core/sock.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c

[PATCH v2] mm/migrate: Avoid possible unnecessary process right check in kernel_move_pages()

2020-08-19 Thread Miaohe Lin
Signed-off-by: Miaohe Lin --- mm/migrate.c | 71 +++- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 34a842a8eb6a..9026876a27dc 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1869,33 +1869,27 @@ static

[PATCH] ceph: Convert to use the preferred fallthrough macro

2020-08-19 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/ceph/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index d51c3f2fdca0..30cd00265181 100644 --- a/fs/ceph

[PATCH] block: Convert to use the preferred fallthrough macro

2020-08-19 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- block/badblocks.c | 2 +- block/bfq-iosched.c | 4 ++-- block/blk-wbt.c | 2 +- block/ioprio.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff

[PATCH] rbd: Convert to use the preferred fallthrough macro

2020-08-19 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- drivers/block/rbd.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index d9c0e7d154f9..011539039693

[PATCH] nfsd: Convert to use the preferred fallthrough macro

2020-08-19 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/nfsd/nfs4callback.c | 2 +- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfs4state.c| 2 +- fs/nfsd/nfsfh.c| 2 +- fs/nfsd/vfs.c | 4 ++-- 5 files changed

[PATCH] fs/adfs: Convert to use the preferred fallthrough macro

2020-08-19 Thread Miaohe Lin
Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Hongxiang Lou Signed-off-by: Miaohe Lin --- fs/adfs/dir_f.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/adfs/dir_f.c b/fs/adfs/dir_f.c index 30d526fecc3f..b9e271595d32 100644

  1   2   3   4   5   >