[PATCH] thp: use mm_file_counter to determine update which rss counter

2018-06-19 Thread Yang Shi
hmem pages are still a part of it. Signed-off-by: Yang Shi Cc: Hugh Dickins Cc: Kirill A. Shutemov --- mm/huge_memory.c | 4 ++-- mm/memory.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 1cd7c1a..2687f7c 100644 --- a/mm/hug

Re: [RFC v2 PATCH 2/2] mm: mmap: zap pages with read mmap_sem for large mapping

2018-06-19 Thread Yang Shi
On 6/19/18 3:02 AM, Peter Zijlstra wrote: On Tue, Jun 19, 2018 at 07:34:16AM +0800, Yang Shi wrote: diff --git a/mm/mmap.c b/mm/mmap.c index fc41c05..e84f80c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2686,6 +2686,141 @@ int split_vma(struct mm_struct *mm, struct vm_area_struct *vma

[PATCH] doc: add description to dirtytime_expire_seconds

2018-05-30 Thread Yang Shi
commit 1efff914afac8a965ad63817ecf8861a927c2ace ("fs: add dirtytime_expire_seconds sysctl") introduced dirtytime_expire_seconds knob, but there is not description about it in Documentation/sysctl/vm.txt. Add the description for it. Cc: Theodore Ts'o Signed-off-by: Yang Shi -

Re: [RFC v3 PATCH 5/5] x86: check VM_DEAD flag in page fault

2018-07-03 Thread Yang Shi
On 7/2/18 11:17 PM, Michal Hocko wrote: On Mon 02-07-18 11:10:23, Yang Shi wrote: On 7/2/18 10:57 AM, Michal Hocko wrote: [...] Why would you even care about shared mappings? Just thought about we are dealing with VM_DEAD, which means the vma will be tore down soon regardless it is shared

Re: [RFC v3 PATCH 4/5] mm: mmap: zap pages with read mmap_sem for large mapping

2018-07-03 Thread Yang Shi
On 7/2/18 11:09 PM, Michal Hocko wrote: On Mon 02-07-18 13:48:45, Andrew Morton wrote: On Mon, 2 Jul 2018 16:05:02 +0200 Michal Hocko wrote: On Fri 29-06-18 20:15:47, Andrew Morton wrote: [...] Would one of your earlier designs have addressed all usecases? I expect the dumb unmap-a-littl

Re: [PATCH 1/2] fs: ext4: use BUG_ON if writepage call comes from direct reclaim

2018-07-03 Thread Yang Shi
On 7/3/18 3:39 AM, Theodore Y. Ts'o wrote: On Tue, Jul 03, 2018 at 12:11:18PM +0800, Yang Shi wrote: direct reclaim doesn't write out filesystem page, only kswapd could do it. So, if the call comes from direct reclaim, it is definitely a bug. And, Mel Gormane also mentioned &

Re: [RFC v3 PATCH 4/5] mm: mmap: zap pages with read mmap_sem for large mapping

2018-07-03 Thread Yang Shi
On 7/2/18 11:09 PM, Michal Hocko wrote: On Mon 02-07-18 13:48:45, Andrew Morton wrote: On Mon, 2 Jul 2018 16:05:02 +0200 Michal Hocko wrote: On Fri 29-06-18 20:15:47, Andrew Morton wrote: [...] Would one of your earlier designs have addressed all usecases? I expect the dumb unmap-a-littl

Re: [PATCH 1/2] fs: ext4: use BUG_ON if writepage call comes from direct reclaim

2018-07-03 Thread Yang Shi
On 7/3/18 10:05 AM, Yang Shi wrote: On 7/3/18 3:39 AM, Theodore Y. Ts'o wrote: On Tue, Jul 03, 2018 at 12:11:18PM +0800, Yang Shi wrote: direct reclaim doesn't write out filesystem page, only kswapd could do it. So, if the call comes from direct reclaim, it is definitely a bug.

Re: [PATCH] doc: add description to dirtytime_expire_seconds

2018-06-14 Thread Yang Shi
ping Ted, Any comment is appreciated. Regards, Yang On 5/30/18 4:56 PM, Yang Shi wrote: commit 1efff914afac8a965ad63817ecf8861a927c2ace ("fs: add dirtytime_expire_seconds sysctl") introduced dirtytime_expire_seconds knob, but there is not description about it in Documentat

[RFC v8 PATCH 0/5] mm: zap pages with read mmap_sem in munmap for large mapping

2018-08-15 Thread Yang Shi
ped to us level from second. munmap_test-15002 [008] 594.380138: funcgraph_entry: | vm_munmap_zap_rlock() { munmap_test-15002 [008] 594.380146: funcgraph_entry: !2485684 us | unmap_region(); munmap_test-15002 [008] 596.865836: funcgraph_exit: !2485692 us | } Here the excuti

[RFC v8 PATCH 1/5] mm: refactor do_munmap() to extract the common part

2018-08-15 Thread Yang Shi
: Vlastimil Babka Signed-off-by: Yang Shi --- mm/mmap.c | 106 +++--- 1 file changed, 74 insertions(+), 32 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 17bbf4d..f05f49b 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2681,35 +2681,42

[RFC v8 PATCH 4/5] mm: unmap VM_HUGETLB mappings with optimized path

2018-08-15 Thread Yang Shi
When unmapping VM_HUGETLB mappings, vm flags need to be updated. Since the vmas have been detached, so it sounds safe to update vm flags with read mmap_sem. Cc: Michal Hocko Cc: Vlastimil Babka Signed-off-by: Yang Shi --- mm/mmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[RFC v8 PATCH 5/5] mm: unmap VM_PFNMAP mappings with optimized path

2018-08-15 Thread Yang Shi
When unmapping VM_PFNMAP mappings, vm flags need to be updated. Since the vmas have been detached, so it sounds safe to update vm flags with read mmap_sem. Cc: Michal Hocko Cc: Vlastimil Babka Signed-off-by: Yang Shi --- mm/mmap.c | 13 + 1 file changed, 5 insertions(+), 8

[RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Yang Shi
d mmap_sem, then the remaining time is used with holding exclusive lock. [1] https://lwn.net/Articles/753269/ Suggested-by: Michal Hocko Suggested-by: Kirill A. Shutemov Cc: Matthew Wilcox Cc: Laurent Dufour Cc: Vlastimil Babka Cc: And

[RFC v8 PATCH 2/5] uprobes: introduce has_uprobes helper

2018-08-15 Thread Yang Shi
Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Vlastimil Babka Signed-off-by: Yang Shi --- include/linux/uprobes.h | 7 +++ kernel/events/uprobes.c | 23 --- 2 files changed, 23 insertions(+), 7 deletions

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Yang Shi
On 8/15/18 2:09 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: (not even compiled, and I can see a good opportunity for combining the VM_LOCKED loop with the has_uprobes loop) I was rushing to get that sent earlier. Here it is tidied up to actually

Re: [RFC v8 PATCH 3/5] mm: mmap: zap pages with read mmap_sem in munmap

2018-08-15 Thread Yang Shi
On 8/15/18 7:46 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 02:54:13PM -0700, Yang Shi wrote: On 8/15/18 2:09 PM, Matthew Wilcox wrote: On Wed, Aug 15, 2018 at 12:16:06PM -0700, Matthew Wilcox wrote: (not even compiled, and I can see a good opportunity for combining the VM_LOCKED

Re: WARNING: locking bug in lock_downgrade

2018-12-12 Thread Yang Shi
Cc'ed Peter, Ingo and Waiman. It took me a few days to look into this warning, but I got lost in lockdep code. The problem is the commit dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap") does an optimization for munmap by downgrading write mmap_sem to read before zapping pa

Re: [PATCH] mm: Reuse only-pte-mapped KSM page in do_wp_page()

2018-12-13 Thread Yang Shi
On 12/13/18 7:29 AM, Kirill Tkhai wrote: This patch adds an optimization for KSM pages almost in the same way, that we have for ordinary anonymous pages. If there is a write fault in a page, which is mapped to an only pte, and it is not related to swap cache; the page may be reused without cop

[RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-17 Thread Yang Shi
ive stall for such case. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- mm/swap_state.c | 4 1 file changed, 4 insertions(+) diff --git a/mm/swap_state.c b/mm/swap_state.c index fd2f21e..7cc3c29 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -538,11 +538

[RFC PATCH 2/2] mm: swap: add comment for swap_vma_readahead

2018-12-17 Thread Yang Shi
swap_vma_readahead()'s comment is missed, just add it. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- mm/swap_state.c | 17 + 1 file changed, 17 insertions(+) diff --git a/mm/swap_state.c b/mm/swap_state.c index 7cc3c29..c12aedf 100644 ---

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-18 Thread Yang Shi
On 12/18/18 11:29 AM, Tim Chen wrote: On 12/17/18 10:52 PM, Yang Shi wrote: diff --git a/mm/swap_state.c b/mm/swap_state.c index fd2f21e..7cc3c29 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -538,11 +538,15 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-18 Thread Yang Shi
On 12/18/18 4:16 PM, Tim Chen wrote: On 12/18/18 3:43 PM, Yang Shi wrote: On 12/18/18 11:29 AM, Tim Chen wrote: On 12/17/18 10:52 PM, Yang Shi wrote: diff --git a/mm/swap_state.c b/mm/swap_state.c index fd2f21e..7cc3c29 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -538,11

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-19 Thread Yang Shi
On 12/19/18 9:28 AM, Tim Chen wrote: On 12/18/18 9:56 PM, Yang Shi wrote: On 12/18/18 4:16 PM, Tim Chen wrote: On 12/18/18 3:43 PM, Yang Shi wrote: On 12/18/18 11:29 AM, Tim Chen wrote: On 12/17/18 10:52 PM, Yang Shi wrote: diff --git a/mm/swap_state.c b/mm/swap_state.c index fd2f21e

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-19 Thread Yang Shi
On 12/19/18 11:00 AM, Tim Chen wrote: On 12/19/18 10:40 AM, Yang Shi wrote: I don't think your dereference inode = si->swap_file->f_mapping->host is always safe.  You should do it only when (si->flags & SWP_FS) is true. Do you mean it is not safe for swap partition?

Re: [PATCH] mm: Reuse only-pte-mapped KSM page in do_wp_page()

2018-12-14 Thread Yang Shi
On 12/14/18 1:26 AM, Kirill Tkhai wrote: On 13.12.2018 22:15, Yang Shi wrote: On 12/13/18 7:29 AM, Kirill Tkhai wrote: This patch adds an optimization for KSM pages almost in the same way, that we have for ordinary anonymous pages. If there is a write fault in a page, which is mapped to an

Re: [PATCH 06/14] mm, migrate: Immediately fail migration of a page with no migration handler

2018-12-20 Thread Yang Shi
On Fri, Dec 14, 2018 at 3:03 PM Mel Gorman wrote: > > Pages with no migration handler use a fallback hander which sometimes > works and sometimes persistently fails such as blockdev pages. Migration A minor correction. The above statement sounds not accurate anymore since Jan Kara had patch serie

[v2 PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-20 Thread Yang Shi
ive stall for such case. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- v2: Check the swap device type per Tim Chen mm/swap_state.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/mm/swap_state.c b/mm/swap_state.c index fd2f21e..ba7e334 100644 --- a/mm/swap_stat

[v2 PATCH 2/2] mm: swap: add comment for swap_vma_readahead

2018-12-20 Thread Yang Shi
swap_vma_readahead()'s comment is missed, just add it. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- mm/swap_state.c | 17 + 1 file changed, 17 insertions(+) diff --git a/mm/swap_state.c b/mm/swap_state.c index ba7e334..b96f369 100644 ---

Re: [PATCH 1/2] mm: vmscan: skip KSM page in direct reclaim if priority is low

2018-12-20 Thread Yang Shi
On 12/20/18 10:04 PM, Hugh Dickins wrote: On Thu, 20 Dec 2018, Andrew Morton wrote: Is anyone interested in reviewing this? Seems somewhat serious. Thanks. Somewhat serious, but no need to rush. From: Yang Shi Subject: mm: vmscan: skip KSM page in direct reclaim if priority is low When

Re: [v2 PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-21 Thread Yang Shi
On 12/21/18 10:34 AM, Tim Chen wrote: On 12/20/18 4:21 PM, Yang Shi wrote: --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -538,11 +538,17 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, bool do_poll = true, page_allocated; struct vm_area_struct

[v3 PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-21 Thread Yang Shi
ive stall for such case. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- v3: Move inode deference under swap device type check per Tim Chen v2: Check the swap device type per Tim Chen mm/swap_state.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/mm/swap_state.

[v3 PATCH 2/2] mm: swap: add comment for swap_vma_readahead

2018-12-21 Thread Yang Shi
swap_vma_readahead()'s comment is missed, just add it. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- mm/swap_state.c | 17 + 1 file changed, 17 insertions(+) diff --git a/mm/swap_state.c b/mm/swap_state.c index 78d500e..dd8f698 100644 ---

Re: [v3 PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-21 Thread Yang Shi
On 12/21/18 2:42 PM, Tim Chen wrote: On 12/21/18 1:40 PM, Yang Shi wrote: Swap readahead would read in a few pages regardless if the underlying device is busy or not. It may incur long waiting time if the device is congested, and it may also exacerbate the congestion. Use

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-04 Thread Yang Shi
On 1/4/19 12:03 PM, Greg Thelen wrote: Yang Shi wrote: On 1/3/19 11:23 AM, Michal Hocko wrote: On Thu 03-01-19 11:10:00, Yang Shi wrote: On 1/3/19 10:53 AM, Michal Hocko wrote: On Thu 03-01-19 10:40:54, Yang Shi wrote: On 1/3/19 10:13 AM, Michal Hocko wrote: [...] Is there any reason

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-04 Thread Yang Shi
On 1/4/19 12:03 PM, Greg Thelen wrote: Yang Shi wrote: On 1/3/19 11:23 AM, Michal Hocko wrote: On Thu 03-01-19 11:10:00, Yang Shi wrote: On 1/3/19 10:53 AM, Michal Hocko wrote: On Thu 03-01-19 10:40:54, Yang Shi wrote: On 1/3/19 10:13 AM, Michal Hocko wrote: [...] Is there any reason

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-04 Thread Yang Shi
On 1/4/19 2:57 PM, Yang Shi wrote: On 1/4/19 12:03 PM, Greg Thelen wrote: Yang Shi wrote: On 1/3/19 11:23 AM, Michal Hocko wrote: On Thu 03-01-19 11:10:00, Yang Shi wrote: On 1/3/19 10:53 AM, Michal Hocko wrote: On Thu 03-01-19 10:40:54, Yang Shi wrote: On 1/3/19 10:13 AM, Michal

[RFC v2 PATCH 0/5] mm: memcontrol: do memory reclaim when offlining

2019-01-04 Thread Yang Shi
#1: Fix some obsolete information about force_empty in the document Patch #2: A minor improvement to skip swap for force_empty Patch #3: Introduces wipe_on_offline interface Patch #4: Being force_empty into default hierarchy Patch #5: Document update Yang Shi (5): doc: memcontrol: fix the obs

[v2 PATCH 5/5] doc: memcontrol: add description for wipe_on_offline

2019-01-04 Thread Yang Shi
Add desprition of wipe_on_offline interface in cgroup documents. Cc: Michal Hocko Cc: Johannes Weiner Signed-off-by: Yang Shi --- Documentation/admin-guide/cgroup-v2.rst | 9 + Documentation/cgroup-v1/memory.txt | 10 ++ 2 files changed, 19 insertions(+) diff --git a

[v2 PATCH 4/5] mm: memcontrol: bring force_empty into default hierarchy

2019-01-04 Thread Yang Shi
force_empty is still needed by some usecases which want to get the memory reclaimed immediately. So, bring force_empty interface in default hierarchy too. Cc: Michal Hocko Cc: Johannes Weiner Signed-off-by: Yang Shi --- Documentation/admin-guide/cgroup-v2.rst | 14 ++

[v2 PATCH 3/5] mm: memcontrol: introduce wipe_on_offline interface

2019-01-04 Thread Yang Shi
e for such usecase sounds reasonable. Introduced a new interface, called wipe_on_offline for both default and legacy hierarchy, which does memory reclaim in css offline kworker. Writing to 1 would enable it, writing 0 would disable it. Suggested-by: Michal Hocko Cc: Johannes Weiner Signed-off-by

[v2 PATCH 2/5] mm: memcontrol: do not try to do swap when force empty

2019-01-04 Thread Yang Shi
10473001049356 Without doing swap, force empty can reclaim 2MB more memory in 1GB page cache. Cc: Michal Hocko Cc: Johannes Weiner Signed-off-by: Yang Shi --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c

[v2 PATCH 1/5] doc: memcontrol: fix the obsolete content about force empty

2019-01-04 Thread Yang Shi
We don't do page cache reparent anymore when offlining memcg, so update force empty related content accordingly. Reviewed-by: Shakeel Butt Acked-by: Michal Hocko Cc: Johannes Weiner Signed-off-by: Yang Shi --- Documentation/cgroup-v1/memory.txt | 7 --- 1 file changed, 4 insertions(

[RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-02 Thread Yang Shi
empty synchronously, any other value will tell kernel to do force empty in css offline worker. Patch #1: Fix some obsolete information about force_empty in the document Patch #2: A minor improvement to skip swap for force_empty Patch #3: Implement delayed force_empty Yang Shi (3): doc: memcontrol

[PATCH 2/3] mm: memcontrol: do not try to do swap when force empty

2019-01-02 Thread Yang Shi
10473001049356 Without doing swap, force empty can reclaim 2MB more memory in 1GB page cache. Cc: Michal Hocko Cc: Johannes Weiner Signed-off-by: Yang Shi --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c

[PATCH 1/3] doc: memcontrol: fix the obsolete content about force empty

2019-01-02 Thread Yang Shi
We don't do page cache reparent anymore when offlining memcg, so update force empty related content accordingly. Cc: Michal Hocko Cc: Johannes Weiner Signed-off-by: Yang Shi --- Documentation/cgroup-v1/memory.txt | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --

[PATCH 3/3] mm: memcontrol: delay force empty to css offline

2019-01-02 Thread Yang Shi
empty synchronously, any other value will tell kernel to do force empty in css offline worker. Cc: Michal Hocko Cc: Johannes Weiner Signed-off-by: Yang Shi --- Documentation/cgroup-v1/memory.txt | 8 ++-- include/linux/memcontrol.h | 2 ++ mm/memcontrol.c

Re: [PATCH 2/3] mm: memcontrol: do not try to do swap when force empty

2019-01-03 Thread Yang Shi
On 1/2/19 1:45 PM, Shakeel Butt wrote: On Wed, Jan 2, 2019 at 12:06 PM Yang Shi wrote: The typical usecase of force empty is to try to reclaim as much as possible memory before offlining a memcg. Since there should be no attached tasks to offlining memcg, the tasks anonymous pages would

Re: [v4 PATCH 1/2] mm: swap: check if swap backing device is congested or not

2019-01-03 Thread Yang Shi
On 1/2/19 3:00 PM, Daniel Jordan wrote: On Sun, Dec 30, 2018 at 12:49:34PM +0800, Yang Shi wrote: The test on my virtual machine with congested HDD shows long tail latency is reduced significantly. Without the patch page_fault1_thr-1490 [023] 129.311706: funcgraph_entry

Re: [v4 PATCH 2/2] mm: swap: add comment for swap_vma_readahead

2019-01-03 Thread Yang Shi
On 1/2/19 11:41 PM, Huang, Ying wrote: Yang Shi writes: swap_vma_readahead()'s comment is missed, just add it. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- mm/swap_state.c | 17 + 1 file changed, 17 insertions(+) diff --git

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-03 Thread Yang Shi
On 1/3/19 2:12 AM, Michal Hocko wrote: On Thu 03-01-19 04:05:30, Yang Shi wrote: Currently, force empty reclaims memory synchronously when writing to memory.force_empty. It may take some time to return and the afterwards operations are blocked by it. Although it can be interrupted by

Re: [PATCH 2/3] mm: memcontrol: do not try to do swap when force empty

2019-01-03 Thread Yang Shi
On 1/3/19 9:03 AM, Shakeel Butt wrote: On Thu, Jan 3, 2019 at 8:57 AM Yang Shi wrote: On 1/2/19 1:45 PM, Shakeel Butt wrote: On Wed, Jan 2, 2019 at 12:06 PM Yang Shi wrote: The typical usecase of force empty is to try to reclaim as much as possible memory before offlining a memcg

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-03 Thread Yang Shi
On 1/3/19 10:13 AM, Michal Hocko wrote: On Thu 03-01-19 09:33:14, Yang Shi wrote: On 1/3/19 2:12 AM, Michal Hocko wrote: On Thu 03-01-19 04:05:30, Yang Shi wrote: Currently, force empty reclaims memory synchronously when writing to memory.force_empty. It may take some time to return and

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-03 Thread Yang Shi
On 1/3/19 10:53 AM, Michal Hocko wrote: On Thu 03-01-19 10:40:54, Yang Shi wrote: On 1/3/19 10:13 AM, Michal Hocko wrote: On Thu 03-01-19 09:33:14, Yang Shi wrote: On 1/3/19 2:12 AM, Michal Hocko wrote: On Thu 03-01-19 04:05:30, Yang Shi wrote: Currently, force empty reclaims memory

[v5 PATCH 2/2] mm: swap: add comment for swap_vma_readahead

2019-01-03 Thread Yang Shi
swap_vma_readahead()'s comment is missed, just add it. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- v5: Fixed the comments per Ying Huang mm/swap_state.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mm/swap_state.c

[v5 PATCH 1/2] mm: swap: check if swap backing device is congested or not

2019-01-03 Thread Yang Shi
try:3.600us | do_swap_page(); runtest.py-1417 [020] 301.935878: funcgraph_entry:7.202us | do_swap_page(); Acked-by: Tim Chen Cc: Huang Ying Cc: Minchan Kim Cc: Daniel Jordan Signed-off-by: Yang Shi --- v5: Elaborate more about the test case per Daniel v4: Added obser

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-03 Thread Yang Shi
On 1/3/19 11:23 AM, Michal Hocko wrote: On Thu 03-01-19 11:10:00, Yang Shi wrote: On 1/3/19 10:53 AM, Michal Hocko wrote: On Thu 03-01-19 10:40:54, Yang Shi wrote: On 1/3/19 10:13 AM, Michal Hocko wrote: [...] Is there any reason for your scripts to be strictly sequential here? In other

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-03 Thread Yang Shi
On 1/3/19 12:01 PM, Michal Hocko wrote: On Thu 03-01-19 11:49:32, Yang Shi wrote: On 1/3/19 11:23 AM, Michal Hocko wrote: On Thu 03-01-19 11:10:00, Yang Shi wrote: On 1/3/19 10:53 AM, Michal Hocko wrote: On Thu 03-01-19 10:40:54, Yang Shi wrote: On 1/3/19 10:13 AM, Michal Hocko wrote

Re: [RFC PATCH 0/3] mm: memcontrol: delayed force empty

2019-01-04 Thread Yang Shi
On 1/4/19 12:55 AM, Michal Hocko wrote: On Thu 03-01-19 20:15:30, Yang Shi wrote: On 1/3/19 12:01 PM, Michal Hocko wrote: On Thu 03-01-19 11:49:32, Yang Shi wrote: On 1/3/19 11:23 AM, Michal Hocko wrote: On Thu 03-01-19 11:10:00, Yang Shi wrote: On 1/3/19 10:53 AM, Michal Hocko wrote

Re: [RFC][PATCH v2 01/21] e820: cheat PMEM as DRAM

2018-12-27 Thread Yang Shi
On Wed, Dec 26, 2018 at 9:13 PM Dan Williams wrote: > > On Wed, Dec 26, 2018 at 8:11 PM Fengguang Wu wrote: > > > > On Wed, Dec 26, 2018 at 07:41:41PM -0800, Matthew Wilcox wrote: > > >On Wed, Dec 26, 2018 at 09:14:47PM +0800, Fengguang Wu wrote: > > >> From: Fan Du > > >> > > >> This is a hack

Re: [RFC][PATCH v2 00/21] PMEM NUMA node and hotness accounting/migration

2018-12-28 Thread Yang Shi
On Fri, Dec 28, 2018 at 5:31 AM Fengguang Wu wrote: > > >> > I haven't looked at the implementation yet but if you are proposing a > >> > special cased zone lists then this is something CDM (Coherent Device > >> > Memory) was trying to do two years ago and there was quite some > >> > skepticism in

Re: [v3 PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-28 Thread Yang Shi
On 12/28/18 4:42 PM, Andrew Morton wrote: On Sat, 22 Dec 2018 05:40:19 +0800 Yang Shi wrote: Swap readahead would read in a few pages regardless if the underlying device is busy or not. It may incur long waiting time if the device is congested, and it may also exacerbate the congestion

[v4 PATCH 2/2] mm: swap: add comment for swap_vma_readahead

2018-12-29 Thread Yang Shi
swap_vma_readahead()'s comment is missed, just add it. Cc: Huang Ying Cc: Tim Chen Cc: Minchan Kim Signed-off-by: Yang Shi --- mm/swap_state.c | 17 + 1 file changed, 17 insertions(+) diff --git a/mm/swap_state.c b/mm/swap_state.c index 78d500e..dd8f698 100644 ---

[v4 PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-29 Thread Yang Shi
5us | do_swap_page(); runtest.py-1417 [020] 301.935871: funcgraph_entry:3.600us | do_swap_page(); runtest.py-1417 [020] 301.935878: funcgraph_entry:7.202us | do_swap_page(); Acked-by: Tim Chen Cc: Huang Ying Cc: Minchan Kim Signed-off-by: Yang Shi ---

[PATCH 1/2] mm: vmscan: skip KSM page in direct reclaim if priority is low

2018-11-07 Thread Yang Shi
age in direct reclaim if the reclaim priority is low, but still try to reclaim KSM page with high priority. Signed-off-by: Yang Shi --- mm/vmscan.c | 23 +-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 62ac0c48..e821ad3 10

[PATCH 2/2] mm: ksm: do not block on page lock when searching stable tree

2018-11-07 Thread Yang Shi
. Introduce async mode to get_ksm_page() to not block on page lock, like what try_to_merge_one_page() does. Return -EBUSY if trylock fails, since NULL means not find suitable KSM page, which is a valid case. Signed-off-by: Yang Shi --- mm/ksm.c | 29 + 1 file changed

[PATCH 1/2 -mm] mm: brk: fix unsigned compare against 0 issue

2018-10-04 Thread Yang Shi
: Andrew Morton Signed-off-by: Yang Shi --- Andrew, this should be able to be folded into the original patch. mm/mmap.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 68dc4fb..c78f7e9 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -242,17 +242,18

[PATCH 2/2 -mm] mm: mremap: fix unsigned compare against 0 issue

2018-10-04 Thread Yang Shi
: Andrew Morton Signed-off-by: Yang Shi --- Andrew, this should be able to be folded into the original patch. mm/mremap.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index 3524d16..f9d5d1f 100644 --- a/mm/mremap.c +++ b/mm/mremap.c

Re: [LKP] [mm] 9bc8039e71: will-it-scale.per_thread_ops -64.1% regression

2018-11-05 Thread Yang Shi
re context switches: 34925294 ± 18%+270.3% 1.293e+08 ± 4% will-it-scale.time.voluntary_context_switches Yang Shi, would you mind taking a look at what's going on? No problem. Actually, the commit is mainly for optimizing the long stall time caused by holding mmap_sem by write wh

Re: [LKP] [mm] 9bc8039e71: will-it-scale.per_thread_ops -64.1% regression

2018-11-05 Thread Yang Shi
On 11/5/18 10:35 AM, Linus Torvalds wrote: On Mon, Nov 5, 2018 at 10:28 AM Yang Shi wrote: Actually, the commit is mainly for optimizing the long stall time caused by holding mmap_sem by write when unmapping or shrinking large mapping. It downgrades write mmap_sem to read when zapping pages

Re: [RFC v10 PATCH 1/3] mm: mmap: zap pages with read mmap_sem in munmap

2018-09-17 Thread Yang Shi
On 9/15/18 2:21 AM, Matthew Wilcox wrote: On Sat, Sep 15, 2018 at 04:34:57AM +0800, Yang Shi wrote: Suggested-by: Michal Hocko Suggested-by: Kirill A. Shutemov Suggested-by: Matthew Wilcox Reviewed-by: Matthew Wilcox Looks good! Thanks for sticking with this patch series. Thanks for

Re: [RFC v10 PATCH 0/3] mm: zap pages with read mmap_sem in munmap for large mapping

2018-09-17 Thread Yang Shi
On 9/15/18 3:10 AM, Matthew Wilcox wrote: On Sat, Sep 15, 2018 at 04:34:56AM +0800, Yang Shi wrote: Regression and performance data: Did the below regression test with setting thresh to 4K manually in the code: * Full LTP * Trinity (munmap/all vm syscalls) * Stress-ng: mmap/mmapfork

Re: [PATCH 1/5] mm: rmap: fix cache flush on THP pages

2022-01-21 Thread Yang Shi
files support PMD-mapped THP, but both don't have to do writeback. And it seems DAX doesn't have writeback either, which uses __set_page_dirty_no_writeback() for set_page_dirty. So this code should never be called IIUC. But anyway your fix looks correct to me. Reviewed-by: Yang Shi

[v8 PATCH 01/13] mm: vmscan: use nid from shrink_control for tracepoint

2021-02-16 Thread Yang Shi
. It seems confusing. And the following patch will remove using nid directly in do_shrink_slab(), this patch also helps cleanup the code. Acked-by: Vlastimil Babka Acked-by: Kirill Tkhai Reviewed-by: Shakeel Butt Acked-by: Roman Gushchin Signed-off-by: Yang Shi --- mm/vmscan.c | 2 +- 1

[v8 PATCH 00/13] Make shrinker's nr_deferred memcg aware

2021-02-16 Thread Yang Shi
We have been running the patched kernel on some hosts of our fleet (test and production) for months, it works very well. The monitor data shows the working set is sustained as expected. Yang Shi (13): mm: vmscan: use nid from shrink_control for tracepoint mm: vmscan: consolidate shrin

[v8 PATCH 04/13] mm: vmscan: remove memcg_shrinker_map_size

2021-02-16 Thread Yang Shi
: Roman Gushchin Acked-by: Vlastimil Babka Signed-off-by: Yang Shi --- mm/vmscan.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 543af6ec1e02..2e753c2516fa 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -185,8 +185,12

[v8 PATCH 05/13] mm: vmscan: use kvfree_rcu instead of call_rcu

2021-02-16 Thread Yang Shi
Using kvfree_rcu() to free the old shrinker_maps instead of call_rcu(). We don't have to define a dedicated callback for call_rcu() anymore. Signed-off-by: Yang Shi --- mm/vmscan.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c

[v8 PATCH 03/13] mm: vmscan: use shrinker_rwsem to protect shrinker_maps allocation

2021-02-16 Thread Yang Shi
larity. And a test with heavy paging workload didn't show write lock makes things worse. Acked-by: Vlastimil Babka Acked-by: Kirill Tkhai Acked-by: Roman Gushchin Signed-off-by: Yang Shi --- mm/vmscan.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/

[v8 PATCH 02/13] mm: vmscan: consolidate shrinker_maps handling code

2021-02-16 Thread Yang Shi
can.c for tighter integration with shrinker code, and remove the "memcg_" prefix. There is no functional change. Acked-by: Vlastimil Babka Acked-by: Kirill Tkhai Acked-by: Roman Gushchin Reviewed-by: Shakeel Butt Signed-off-by: Yang Shi --- include/linux/memcontrol.h | 11 ++-- m

[v8 PATCH 07/13] mm: vmscan: add shrinker_info_protected() helper

2021-02-16 Thread Yang Shi
ct the dereference into a helper to make the code more readable. No functional change. Acked-by: Roman Gushchin Acked-by: Kirill Tkhai Acked-by: Vlastimil Babka Signed-off-by: Yang Shi --- mm/vmscan.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mm/vmscan.

[v8 PATCH 06/13] mm: memcontrol: rename shrinker_map to shrinker_info

2021-02-16 Thread Yang Shi
he "memcg_" prefix. Acked-by: Vlastimil Babka Acked-by: Kirill Tkhai Acked-by: Roman Gushchin Signed-off-by: Yang Shi --- include/linux/memcontrol.h | 8 +++--- mm/memcontrol.c| 6 ++-- mm/vmscan.c| 58 +++--- 3 files changed,

[v8 PATCH 08/13] mm: vmscan: use a new flag to indicate shrinker is registered

2021-02-16 Thread Yang Shi
This would prevent the shrinkers from unregistering correctly. Remove SHRINKER_REGISTERING since we could check if shrinker is registered successfully by the new flag. Acked-by: Kirill Tkhai Acked-by: Vlastimil Babka Signed-off-by: Yang Shi --- include/linux/shrinker.h | 7 ---

[v8 PATCH 09/13] mm: vmscan: add per memcg shrinker nr_deferred

2021-02-16 Thread Yang Shi
ed all the time. Signed-off-by: Yang Shi --- include/linux/memcontrol.h | 7 +++-- mm/vmscan.c| 60 ++ 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 4c9253896e25..c

[v8 PATCH 10/13] mm: vmscan: use per memcg nr_deferred of shrinker

2021-02-16 Thread Yang Shi
Use per memcg's nr_deferred for memcg aware shrinkers. The shrinker's nr_deferred will be used in the following cases: 1. Non memcg aware shrinkers 2. !CONFIG_MEMCG 3. memcg is disabled by boot parameter Signed-off-by: Yang Shi --- mm/vms

[v8 PATCH 11/13] mm: vmscan: don't need allocate shrinker->nr_deferred for memcg aware shrinkers

2021-02-16 Thread Yang Shi
rinker's SHRINKER_MEMCG_AWARE flag would be cleared. This makes the implementation of this patch simpler. Acked-by: Vlastimil Babka Reviewed-by: Kirill Tkhai Acked-by: Roman Gushchin Signed-off-by: Yang Shi --- mm/vmscan.c | 31 --- 1 file changed, 16 insertions(+), 15 delet

[v8 PATCH 12/13] mm: memcontrol: reparent nr_deferred when memcg offline

2021-02-16 Thread Yang Shi
Now shrinker's nr_deferred is per memcg for memcg aware shrinkers, add to parent's corresponding nr_deferred when memcg offline. Acked-by: Vlastimil Babka Acked-by: Kirill Tkhai Acked-by: Roman Gushchin Signed-off-by: Yang Shi --- include/linux/memcontrol.h | 1 + mm/me

[v8 PATCH 13/13] mm: vmscan: shrink deferred objects proportional to priority

2021-02-16 Thread Yang Shi
x27;s patch: https://lore.kernel.org/linux-xfs/20191031234618.15403-13-da...@fromorbit.com/ Tested with kernel build and vfs metadata heavy workload in our production environment, no regression is spotted so far. Signed-off-by: Yang Shi --- mm/vmscan.c

Re: [RFC PATCH 0/6] mm: thp: use generic THP migration for NUMA hinting fault

2021-04-07 Thread Yang Shi
On Wed, Apr 7, 2021 at 1:32 AM Mel Gorman wrote: > > On Tue, Apr 06, 2021 at 09:42:07AM -0700, Yang Shi wrote: > > On Tue, Apr 6, 2021 at 5:03 AM Gerald Schaefer > > wrote: > > > > > > On Thu, 1 Apr 2021 13:10:49 -0700 > > > Yang Shi wrote: >

Re: [PATCH v2 1/2] mm: khugepaged: use macro to align addresses

2021-04-07 Thread Yang Shi
On Tue, Apr 6, 2021 at 8:06 PM wrote: > > From: Yanfei Xu > > We could use macro to deal with the addresses which need to be aligned > to improve readability of codes. Reviewed-by: Yang Shi > > Signed-off-by: Yanfei Xu > --- > mm/khugepaged.c | 27 ++

Re: [PATCH v2 2/2] mm: khugepaged: check MMF_DISABLE_THP ahead of iterating over vmas

2021-04-07 Thread Yang Shi
On Tue, Apr 6, 2021 at 8:06 PM wrote: > > From: Yanfei Xu > > We could check MMF_DISABLE_THP ahead of iterating over all of vma. > Otherwise if some mm_struct contain a large number of vma, there will > be amounts meaningless cpu cycles cost. Reviewed-by: Yang Shi > >

Re: [PATCH 04/10] mm/migrate: make migrate_pages() return nr_succeeded

2021-04-08 Thread Yang Shi
On Thu, Apr 8, 2021 at 3:14 AM Oscar Salvador wrote: > > On Thu, Apr 01, 2021 at 11:32:23AM -0700, Dave Hansen wrote: > > > > From: Yang Shi > > > > The migrate_pages() returns the number of pages that were not migrated, > > or an error code. When returni

Re: [RFC PATCH v1 00/11] Manage the top tier memory in a tiered memory

2021-04-08 Thread Yang Shi
On Thu, Apr 8, 2021 at 10:19 AM Shakeel Butt wrote: > > Hi Tim, > > On Mon, Apr 5, 2021 at 11:08 AM Tim Chen wrote: > > > > Traditionally, all memory is DRAM. Some DRAM might be closer/faster than > > others NUMA wise, but a byte of media has about the same cost whether it > > is close or far.

Re: [PATCH 04/10] mm/migrate: make migrate_pages() return nr_succeeded

2021-04-08 Thread Yang Shi
On Thu, Apr 8, 2021 at 11:17 AM Oscar Salvador wrote: > > On Thu, Apr 08, 2021 at 10:26:54AM -0700, Yang Shi wrote: > > > Thanks, Oscar. Yes, kind of. But we have to remember to initialize > > "nr_succedded" pointer properly for every migrate_pages() callsite, &g

Re: [RFC PATCH v1 00/11] Manage the top tier memory in a tiered memory

2021-04-08 Thread Yang Shi
On Thu, Apr 8, 2021 at 1:29 PM Shakeel Butt wrote: > > On Thu, Apr 8, 2021 at 11:01 AM Yang Shi wrote: > > > > On Thu, Apr 8, 2021 at 10:19 AM Shakeel Butt wrote: > > > > > > Hi Tim, > > > > > > On Mon, Apr 5, 2021 at 11:08 AM Tim Chen >

Re: [RFC PATCH 0/4 v2] Define killable version for access_remote_vm() and use it in fs/proc

2018-02-28 Thread Yang Shi
On 2/26/18 5:47 PM, David Rientjes wrote: On Mon, 26 Feb 2018, Yang Shi wrote: Rather than killable, we have patches that introduce down_read_unfair() variants for the files you've modified (cmdline and environ) as well as others (maps, numa_maps, smaps). You mean you have

Re: [RFC] prctl: Deprecate non PR_SET_MM_MAP operations

2018-04-03 Thread Yang Shi
this interface after a couple of releases. CC: Andrey Vagin CC: Andrew Morton CC: Pavel Emelyanov CC: Michael Kerrisk CC: Yang Shi CC: Michal Hocko Signed-off-by: Cyrill Gorcunov --- Or we can simply drop it off because PR_SET_MM_MAP covers all needs, and I would rather prefer to do that

Re: [RFC] prctl: Deprecate non PR_SET_MM_MAP operations

2018-04-04 Thread Yang Shi
On 4/3/18 10:35 PM, Michal Hocko wrote: On Tue 03-04-18 16:15:20, Yang Shi wrote: On 4/3/18 3:37 PM, Cyrill Gorcunov wrote: An ability to manipulate mm_struct fields was introduced in sake of CRIU in first place. Later we provide more suitable and safe operation PR_SET_MM_MAP where all

Re: [PATCH] prctl: Deprecate non PR_SET_MM_MAP operations

2018-04-04 Thread Yang Shi
orton CC: Pavel Emelyanov CC: Michael Kerrisk CC: Yang Shi CC: Michal Hocko Signed-off-by: Cyrill Gorcunov --- kernel/sys.c | 146 --- 1 file changed, 2 insertions(+), 144 deletions(-) Index: linux-ml.git/kernel/

Re: [PATCH v2] prctl: Deprecate non PR_SET_MM_MAP operations

2018-04-05 Thread Yang Shi
ssage - Drop redundant args check CC: Andrey Vagin CC: Andrew Morton CC: Pavel Emelyanov CC: Michael Kerrisk CC: Yang Shi CC: Michal Hocko Signed-off-by: Cyrill Gorcunov Acked-by: Yang Shi --- kernel/sys.c | 151 --- 1 file chang

Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct

2018-03-27 Thread Yang Shi
On 3/27/18 2:29 AM, Michal Hocko wrote: On Tue 27-03-18 02:20:39, Yang Shi wrote: [...] The patch looks reasonable to me. Maybe it would be better to be more explicit about the purpose of the patch. As others noticed, this alone wouldn't solve the mmap_sem contention issues. I _think_ th

<    1   2   3   4   5   6   7   8   9   10   >