[PATCH -mm -v6 5/9] mm, THP, swap: Support to clear SWAP_HAS_CACHE for huge page

2017-03-07 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> __swapcache_free() is added to support to clear the SWAP_HAS_CACHE flag for the huge page. This will free the specified swap cluster now. Because now this function will be called only in the error path to free the swap cluster just allocate

[PATCH -mm -v6 6/9] mm, THP, swap: Support to add/delete THP to/from swap cache

2017-03-07 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> With this patch, a THP (Transparent Huge Page) can be added/deleted to/from the swap cache as a set of (HPAGE_PMD_NR) sub-pages. This will be used for the THP (Transparent Huge Page) swap support. Where one THP may be added/delted to/from the swap

[PATCH -mm -v6 4/9] mm, THP, swap: Add get_huge_swap_page()

2017-03-07 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> A variation of get_swap_page(), get_huge_swap_page(), is added to allocate a swap cluster (HPAGE_PMD_NR swap slots) based on the swap cluster allocation function. A fair simple algorithm is used, that is, only the first swap device in priorit

[PATCH -mm -v6 3/9] mm, THP, swap: Add swap cluster allocate/free functions

2017-03-07 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The swap cluster allocation/free functions are added based on the existing swap cluster management mechanism for SSD. These functions don't work for the rotating hard disks because the existing swap cluster management mechanism doesn't work fo

Re: [PATCH -mm -v2] mm, swap: Use kvzalloc to allocate some swap data structure

2017-04-06 Thread Huang, Ying
Hi, Matthew, Matthew Wilcox <wi...@infradead.org> writes: > On Wed, Apr 05, 2017 at 03:10:58PM +0800, Huang, Ying wrote: >> In general, kmalloc() will have less memory fragmentation than >> vmalloc(). From Dave Hansen: For example, we have a two-page data >> stru

[PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-07 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> To reduce the lock contention of swap_info_struct->lock when freeing swap entry. The freed swap entries will be collected in a per-CPU buffer firstly, and be really freed later in batch. During the batch freeing, if the consecutive swap entries i

[PATCH -mm -v3] mm, swap: Use kvzalloc to allocate some swap data structure

2017-04-07 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> Now vzalloc() is used in swap code to allocate various data structures, such as swap cache, swap slots cache, cluster info, etc. Because the size may be too large on some system, so that normal kzalloc() may fail. But using kzalloc() has some adva

Re: [PATCH -mm -v8 1/3] mm, THP, swap: Delay splitting THP during swap out

2017-04-17 Thread Huang, Ying
Johannes Weiner <han...@cmpxchg.org> writes: > On Sat, Apr 15, 2017 at 09:17:04AM +0800, Huang, Ying wrote: >> Hi, Johannes, >> >> Johannes Weiner <han...@cmpxchg.org> writes: >> >> > Hi Huang, >> > >> > I reviewed this patch bas

Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-19 Thread Huang, Ying
Minchan Kim <minc...@kernel.org> writes: > Hi Huang, > > On Fri, Apr 07, 2017 at 02:49:01PM +0800, Huang, Ying wrote: >> From: Huang Ying <ying.hu...@intel.com> >> >> To reduce the lock contention of swap_info_struct->lock when freeing >> swap

Re: [PATCH 1/3] percpu: Add alloc_percpu_aligned()

2017-08-02 Thread Huang, Ying
Christopher Lameter <c...@linux.com> writes: > On Wed, 2 Aug 2017, Huang, Ying wrote: > >> --- a/include/linux/percpu.h >> +++ b/include/linux/percpu.h >> @@ -129,5 +129,8 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);

[PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

2017-08-02 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> struct call_single_data is used in IPI to transfer information between CPUs. Its size is bigger than sizeof(unsigned long) and less than cache line size. Now, it is allocated with no any alignment requirement. This makes it possible for all

[PATCH 2/3] iova: Use alloc_percpu_aligned()

2017-08-02 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> To use the newly introduced alloc_percpu_aligned(), which can allocate cache line size aligned percpu memory dynamically. Signed-off-by: "Huang, Ying" <ying.hu...@intel.com> Cc: Joerg Roedel <j...@8bytes.org> Cc: io..

[PATCH 0/3] IPI: Avoid to use 2 cache lines for one call_single_data

2017-08-02 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> struct call_single_data is used in IPI to transfer information between CPUs. Its size is bigger than sizeof(unsigned long) and less than cache line size. Now, it is allocated with no any alignment requirement. This makes it possible for all

[PATCH 1/3] percpu: Add alloc_percpu_aligned()

2017-08-02 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> To allocate percpu memory that is aligned with cache line size dynamically. We can statically allocate percpu memory that is aligned with cache line size with DEFINE_PER_CPU_ALIGNED(), but we have no correspondent API for dynamic allocation. Sign

Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

2017-08-03 Thread Huang, Ying
Eric Dumazet <eric.duma...@gmail.com> writes: > On Wed, 2017-08-02 at 16:52 +0800, Huang, Ying wrote: >> From: Huang Ying <ying.hu...@intel.com> >> >> struct call_single_data is used in IPI to transfer information between >> CPUs. Its size is bigger t

Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

2017-08-03 Thread Huang, Ying
"Huang, Ying" <ying.hu...@intel.com> writes: > Peter Zijlstra <pet...@infradead.org> writes: > [snip] >> diff --git a/include/linux/smp.h b/include/linux/smp.h >> index 68123c1fe549..8d817cb80a38 100644 >> --- a/include/linux/smp.h >> +++ b/inc

Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

2017-08-03 Thread Huang, Ying
__aligned(sizeof(struct __call_single_data)); > + Another requirement of the alignment is that it should be the power of 2. Otherwise, for example, if someone adds a field to struct, so that the size becomes 40 on x86_64. The alignment should be 64 instead of 40. Best Regards, Huang, Ying

[PATCH -mm -v2] mm: Clear to access sub-page last when clearing huge page

2017-08-14 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> Huge page helps to reduce TLB miss rate, but it has higher cache footprint, sometimes this may cause some issue. For example, when clearing huge page on x86_64 platform, the cache footprint is 2M. But on a Xeon E5 v3 2699 CPU, there are 18 cor

Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

2017-08-13 Thread Huang, Ying
Hi, Peter, "Huang, Ying" <ying.hu...@intel.com> writes: > Peter Zijlstra <pet...@infradead.org> writes: > >> On Sat, Aug 05, 2017 at 08:47:02AM +0800, Huang, Ying wrote: >>> Yes. That looks good. So you will prepare the final patch? Or you >>

Re: [PATCH -mm -v2 2/6] mm, swap: Add swap readahead hit statistics

2017-07-11 Thread Huang, Ying
Dave Hansen <dave.han...@intel.com> writes: > On 06/29/2017 06:44 PM, Huang, Ying wrote: >> >> static atomic_t swapin_readahead_hits = ATOMIC_INIT(4); >> +static atomic_long_t swapin_readahead_hits_total = ATOMIC_INIT(0); >> +static atomic_long_t swapi

Re: [PATCH 2/2] mm/swap: Remove lock_initialized flag from swap_slots_cache

2017-07-23 Thread Huang, Ying
be onlined alloc_swap_slot_cache() mutex_lock(cache[B]->alloc_lock) mutex_init(cache[B]->alloc_lock) !!! The cache[B]->alloc_lock will be reinitialized when it is still held. Best Regards, Huang, Ying > Reporte

[PATCH -mm -v3 12/12] mm, THP, swap: Add THP swapping out fallback counting

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> When swapping out THP (Transparent Huge Page), instead of swapping out the THP as a whole, sometimes we have to fallback to split the THP into normal pages before swapping, because no free swap clusters are available, or cgroup limit is exceede

[PATCH -mm -v3 10/12] memcg, THP, swap: Make mem_cgroup_swapout() support THP

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> This patch makes mem_cgroup_swapout() works for the transparent huge page (THP). Which will move the memory cgroup charge from memory to swap for a THP. This will be used for the THP swap support. Where a THP may be swapped out as a whole to

[PATCH -mm -v3 07/12] mm, THP, swap: Support to split THP for THP swapped out

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> After adding swapping out support for THP (Transparent Huge Page), it is possible that a THP in swap cache (partly swapped out) need to be split. To split such a THP, the swap cluster backing the THP need to be split too, that is, the CLUSTER_FLA

[PATCH -mm -v3 11/12] mm, THP, swap: Delay splitting THP after swapped out

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> In this patch, splitting transparent huge page (THP) during swapping out is delayed from after adding the THP into the swap cache to after swapping out finishes. After the patch, more operations for the anonymous THP reclaiming, such as writing t

[PATCH -mm -v3 06/12] Test code to write THP to swap device as a whole

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> To support to delay splitting THP (Transparent Huge Page) after swapped out. We need to enhance swap writing code to support to write a THP as a whole. This will improve swap write IO performance. As Ming Lei <ming@redhat.com>

[PATCH -mm -v3 05/12] block, THP: Make block_device_operations.rw_page support THP

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The .rw_page in struct block_device_operations is used by the swap subsystem to read/write the page contents from/into the corresponding swap slot in the swap device. To support the THP (Transparent Huge Page) swap optimization, the .rw_page is en

[PATCH -mm -v3 03/12] mm, THP, swap: Make reuse_swap_page() works for THP swapped out

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> After supporting to delay THP (Transparent Huge Page) splitting after swapped out, it is possible that some page table mappings of the THP are turned into swap entries. So reuse_swap_page() need to check the swap count in addition to the map

[PATCH -mm -v3 04/12] mm, THP, swap: Don't allocate huge cluster for file backed swap device

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> It's hard to write a whole transparent huge page (THP) to a file backed swap device during swapping out and the file backed swap device isn't very popular. So the huge cluster allocation for the file backed swap device is disabled. Signed-off-by:

[PATCH -mm -v3 08/12] memcg, THP, swap: Support move mem cgroup charge for THP swapped out

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> PTE mapped THP (Transparent Huge Page) will be ignored when moving memory cgroup charge. But for THP which is in the swap cache, the memory cgroup charge for the swap of a tail-page may be moved in current implementation. That isn't correct, b

[PATCH -mm -v3 09/12] memcg, THP, swap: Avoid to duplicated charge THP in swap cache

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> For a THP (Transparent Huge Page), tail_page->mem_cgroup is NULL. So to check whether the page is charged already, we need to check the head page. This is not an issue before because it is impossible for a THP to be in the swap cache before. But

Is it possible to use ftrace to measure secondary CPU bootup time

2017-07-23 Thread Huang, Ying
(before core_initcall()?). So, do you think it is possible to use ftrace to measure secondary CPU bootup time? Thanks, Huang, Ying

[PATCH -mm -v3 02/12] mm, THP, swap: Support to reclaim swap space for THP swapped out

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The normal swap slot reclaiming can be done when the swap count reaches SWAP_HAS_CACHE. But for the swap slot which is backing a THP, all swap slots backing one THP must be reclaimed together, because the swap slot may be used again when the THP is s

[PATCH -mm -v3 01/12] mm, THP, swap: Support to clear swap cache flag for THP swapped out

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> Previously, swapcache_free_cluster() is used only in the error path of shrink_page_list() to free the swap cluster just allocated if the THP (Transparent Huge Page) is failed to be split. In this patch, it is enhanced to clear the swap cach

[PATCH -mm -v3 00/12] mm, THP, swap: Delay splitting THP after swapped out

2017-07-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> Hi, Andrew, could you help me to check whether the overall design is reasonable? Hi, Johannes and Minchan, Thanks a lot for your review to the first step of the THP swap optimization! Could you help me to review the second step in this patchset? Hi

Re: [PATCH -mm -v2 00/12] mm, THP, swap: Delay splitting THP after swapped out

2017-07-23 Thread Huang, Ying
Andrew Morton <a...@linux-foundation.org> writes: > On Fri, 23 Jun 2017 15:12:51 +0800 "Huang, Ying" <ying.hu...@intel.com> wrote: > >> From: Huang Ying <ying.hu...@intel.com> >> >> Hi, Andrew, could you help me to check whether the

Re: Is it possible to use ftrace to measure secondary CPU bootup time

2017-07-24 Thread Huang, Ying
Steven Rostedt <rost...@goodmis.org> writes: > On Mon, 24 Jul 2017 13:46:07 +0800 > "Huang\, Ying" <ying.hu...@intel.com> wrote: > >> Hi, Steven, >> >> We are working on parallelizing secondary CPU bootup. So we need to >> measure the bo

[PATCH -mm -v3 4/6] mm, swap: VMA based swap readahead

2017-07-24 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The swap readahead is an important mechanism to reduce the swap in latency. Although pure sequential memory access pattern isn't very popular for anonymous memory, the space locality is still considered valid. In the original swap readahead implemen

[PATCH -mm -v3 6/6] mm, swap: Don't use VMA based swap readahead if HDD is used as swap

2017-07-24 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> VMA based swap readahead will readahead the virtual pages that is continuous in the virtual address space. While the original swap readahead will readahead the swap slots that is continuous in the swap device. Although VMA based swap readahead i

[PATCH -mm -v3 1/6] mm, swap: Add swap cache statistics sysfs interface

2017-07-24 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The swap cache stats could be gotten only via sysrq, which isn't convenient in some situation. So the sysfs interface of swap cache stats is added for that. The added sysfs directories/files are as follow, /sys/kernel/mm/swap /sys/kernel/m

[PATCH -mm -v3 5/6] mm, swap: Add sysfs interface for VMA based swap readahead

2017-07-24 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The sysfs interface to control the VMA based swap readahead is added as follow, /sys/kernel/mm/swap/vma_ra_enabled Enable the VMA based swap readahead algorithm, or use the original global swap readahead algorithm. /sys/kernel/mm/swap/vma_ra_max

[PATCH -mm -v3 2/6] mm, swap: Add swap readahead hit statistics

2017-07-24 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The statistics for total readahead pages and total readahead hits are recorded and exported via the following sysfs interface. /sys/kernel/mm/swap/ra_hits /sys/kernel/mm/swap/ra_total With them, the efficiency of the swap readahead could be measur

[PATCH -mm -v3 3/6] mm, swap: Fix swap readahead marking

2017-07-24 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> In the original implementation, it is possible that the existing pages in the swap cache (not newly readahead) could be marked as the readahead pages. This will cause the statistics of swap readahead be wrong and influence the swap readahead algorit

[PATCH -mm -v3 0/6] mm, swap: VMA based swap readahead

2017-07-24 Thread Huang, Ying
is high, shows that the space locality is still valid in some practical workloads. Changelogs: v3: - Rebased on latest -mm tree - Use percpu_counter for swap readahead statistics per Dave Hansen's comment. Best Regards, Huang, Ying

[PATCH -mm -v2 0/6] mm, swap: VMA based swap readahead

2017-06-29 Thread Huang, Ying
The swap readahead is an important mechanism to reduce the swap in latency. Although pure sequential memory access pattern isn't very popular for anonymous memory, the space locality is still considered valid. In the original swap readahead implementation, the consecutive blocks in swap device

[PATCH -mm -v2 1/6] mm, swap: Add swap cache statistics sysfs interface

2017-06-29 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The swap cache stats could be gotten only via sysrq, which isn't convenient in some situation. So the sysfs interface of swap cache stats is added for that. The added sysfs directories/files are as follow, /sys/kernel/mm/swap /sys/kernel/m

[PATCH -mm -v2 5/6] mm, swap: Add sysfs interface for VMA based swap readahead

2017-06-29 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The sysfs interface to control the VMA based swap readahead is added as follow, /sys/kernel/mm/swap/vma_ra_enabled Enable the VMA based swap readahead algorithm, or use the original global swap readahead algorithm. /sys/kernel/mm/swap/vma_ra_max

[PATCH -mm -v2 4/6] mm, swap: VMA based swap readahead

2017-06-29 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The swap readahead is an important mechanism to reduce the swap in latency. Although pure sequential memory access pattern isn't very popular for anonymous memory, the space locality is still considered valid. In the original swap readahead implemen

[PATCH -mm -v2 6/6] mm, swap: Don't use VMA based swap readahead if HDD is used as swap

2017-06-29 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> VMA based swap readahead will readahead the virtual pages that is continuous in the virtual address space. While the original swap readahead will readahead the swap slots that is continuous in the swap device. Although VMA based swap readahead i

[PATCH -mm -v2 2/6] mm, swap: Add swap readahead hit statistics

2017-06-29 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The statistics for total readahead pages and total readahead hits are recorded and exported via the following sysfs interface. /sys/kernel/mm/swap/ra_hits /sys/kernel/mm/swap/ra_total With them, the efficiency of the swap readahead could be measur

[PATCH -mm -v2 3/6] mm, swap: Fix swap readahead marking

2017-06-29 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> In the original implementation, it is possible that the existing pages in the swap cache (not newly readahead) could be marked as the readahead pages. This will cause the statistics of swap readahead be wrong and influence the swap readahead algorit

Re: [PATCH -mm -v2 0/6] mm, swap: VMA based swap readahead

2017-06-30 Thread Huang, Ying
! Hi, Johannes, Do you have time to take a look at this patchset? Best Regards, Huang, Ying [snip]

Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-26 Thread Huang, Ying
Minchan Kim <minc...@kernel.org> writes: > On Fri, Apr 21, 2017 at 08:29:30PM +0800, Huang, Ying wrote: >> "Huang, Ying" <ying.hu...@intel.com> writes: >> >> > Minchan Kim <minc...@kernel.org> writes: >> > >> >> On Wed

Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-26 Thread Huang, Ying
Tim Chen <tim.c.c...@linux.intel.com> writes: >> >> From 7bd903c42749c448ef6acbbdee8dcbc1c5b498b9 Mon Sep 17 00:00:00 2001 >> From: Huang Ying <ying.hu...@intel.com> >> Date: Thu, 23 Feb 2017 13:05:20 +0800 >> Subject: [PATCH -v5] mm, swap: Sort swap

Re: [PATCH -mm -v10 1/3] mm, THP, swap: Delay splitting THP during swap out

2017-04-27 Thread Huang, Ying
Minchan Kim <minc...@kernel.org> writes: > On Tue, Apr 25, 2017 at 08:56:56PM +0800, Huang, Ying wrote: >> From: Huang Ying <ying.hu...@intel.com> >> >> In this patch, splitting huge page is delayed from almost the first >> step of swapping out to after a

Re: [PATCH -mm -v9 1/3] mm, THP, swap: Delay splitting THP during swap out

2017-04-21 Thread Huang, Ying
= 0; i < SWAPFILE_CLUSTER; i++) { >> > + VM_BUG_ON(map[i] != SWAP_HAS_CACHE); >> > + map[i] = 0; >> > + } >> > + unlock_cluster(ci); >> > + mem_cgroup_uncharge_swap(entry, SWAPFILE_CLUSTER); >> > + swap_free_cluster(si, idx); >> > + spin_unlock(>lock); >> > +} >> > +#endif /* CONFIG_THP_SWAP */ >> > + >> > static int swp_entry_cmp(const void *ent1, const void *ent2) >> > { >> >const swp_entry_t *e1 = ent1, *e2 = ent2; >> >> >> This is a massive patch, I presume you've got recommendations to keep it >> this way? > > It used to be split into patches that introduce API and helpers on one > hand and patches that use these functions on the other hand. That was > impossible to review, because you had to jump between emails. > > If you have ideas about which parts could be split out and be > stand-alone changes in their own right, I'd be all for that. Best Regards, Huang, Ying

[PATCH -mm -v10 0/3] THP swap: Delay splitting THP during swapping out

2017-04-25 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> This patchset is to optimize the performance of Transparent Huge Page (THP) swap. Recently, the performance of the storage devices improved so fast that we cannot saturate the disk bandwidth with single logical CPU when do page swap out even on a hi

[PATCH -mm -v10 1/3] mm, THP, swap: Delay splitting THP during swap out

2017-04-25 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> In this patch, splitting huge page is delayed from almost the first step of swapping out to after allocating the swap space for the THP (Transparent Huge Page) and adding the THP into the swap cache. This will batch the corresponding operation, thus i

[PATCH -mm -v10 2/3] mm, THP, swap: Check whether THP can be split firstly

2017-04-25 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> To swap out THP (Transparent Huage Page), before splitting the THP, the swap cluster will be allocated and the THP will be added into the swap cache. But it is possible that the THP cannot be split, so that we must delete the THP from the swap

[PATCH -mm -v10 3/3] mm, THP, swap: Enable THP swap optimization only if has compound map

2017-04-25 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> If there is no compound map for a THP (Transparent Huge Page), it is possible that the map count of some sub-pages of the THP is 0. So it is better to split the THP before swapping out. In this way, the sub-pages not mapped will be freed, and we can

Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-28 Thread Huang, Ying
Minchan Kim <minc...@kernel.org> writes: > On Fri, Apr 28, 2017 at 04:05:26PM +0800, Huang, Ying wrote: >> Minchan Kim <minc...@kernel.org> writes: >> >> > On Fri, Apr 28, 2017 at 09:09:53AM +0800, Huang, Ying wrote: >> >> Minchan Kim <minc..

Re: [PATCH -mm -v10 1/3] mm, THP, swap: Delay splitting THP during swap out

2017-04-28 Thread Huang, Ying
Minchan Kim <minc...@kernel.org> writes: > On Thu, Apr 27, 2017 at 03:12:34PM +0800, Huang, Ying wrote: >> Minchan Kim <minc...@kernel.org> writes: >> >> > On Tue, Apr 25, 2017 at 08:56:56PM +0800, Huang, Ying wrote: >> >> From: Huang Ying &

Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-28 Thread Huang, Ying
"Huang, Ying" <ying.hu...@intel.com> writes: > Minchan Kim <minc...@kernel.org> writes: > >> On Fri, Apr 28, 2017 at 04:05:26PM +0800, Huang, Ying wrote: >>> Minchan Kim <minc...@kernel.org> writes: >>> >>> > On Fri, Apr 28,

Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-27 Thread Huang, Ying
Minchan Kim <minc...@kernel.org> writes: > On Wed, Apr 26, 2017 at 08:42:10PM +0800, Huang, Ying wrote: >> Minchan Kim <minc...@kernel.org> writes: >> >> > On Fri, Apr 21, 2017 at 08:29:30PM +0800, Huang, Ying wrote: >> >> "Huang, Ying"

Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free

2017-04-28 Thread Huang, Ying
Minchan Kim <minc...@kernel.org> writes: > On Fri, Apr 28, 2017 at 09:09:53AM +0800, Huang, Ying wrote: >> Minchan Kim <minc...@kernel.org> writes: >> >> > On Wed, Apr 26, 2017 at 08:42:10PM +0800, Huang, Ying wrote: >> >> Minchan Kim <minc..

Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

2017-08-04 Thread Huang, Ying
Peter Zijlstra <pet...@infradead.org> writes: > On Fri, Aug 04, 2017 at 10:05:55AM +0800, Huang, Ying wrote: >> "Huang, Ying" <ying.hu...@intel.com> writes: >> > Peter Zijlstra <pet...@infradead.org> writes: > >> >>

Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-08 Thread Huang, Ying
Matthew Wilcox <wi...@infradead.org> writes: > On Mon, Aug 07, 2017 at 03:21:31PM +0800, Huang, Ying wrote: >> @@ -2509,7 +2509,8 @@ enum mf_action_page_type { >> #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS) >> extern void clear_

Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-08 Thread Huang, Ying
"Huang, Ying" <ying.hu...@intel.com> writes: > "Kirill A. Shutemov" <kir...@shutemov.name> writes: > >> On Mon, Aug 07, 2017 at 03:21:31PM +0800, Huang, Ying wrote: >>> From: Huang Ying <ying.hu...@intel.com> >>> >>> H

Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-07 Thread Huang, Ying
Mike Kravetz <mike.krav...@oracle.com> writes: > On 08/07/2017 12:21 AM, Huang, Ying wrote: >> From: Huang Ying <ying.hu...@intel.com> >> >> Huge page helps to reduce TLB miss rate, but it has higher cache >> footprint, sometimes this may cause some iss

Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-08 Thread Huang, Ying
Christopher Lameter <c...@linux.com> writes: > On Mon, 7 Aug 2017, Huang, Ying wrote: > >> --- a/mm/memory.c >> +++ b/mm/memory.c >> @@ -4374,9 +4374,31 @@ void clear_huge_page(struct page *page, >> } >> >> might_sleep()

Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

2017-08-07 Thread Huang, Ying
Peter Zijlstra <pet...@infradead.org> writes: > On Sat, Aug 05, 2017 at 08:47:02AM +0800, Huang, Ying wrote: >> Yes. That looks good. So you will prepare the final patch? Or you >> hope me to do that? > > I was hoping you'd do it ;-) Thanks! Here is the updated

Re: "BUG: unable to handle kernel NULL pointer dereference" in swapping shmem

2017-07-31 Thread Huang, Ying
[ 113.336121] ---[ end trace 2cd503b4980b0afc ]--- > [ 113.341281] Kernel panic - not syncing: Fatal exception > [ 113.347398] Kernel Offset: 0x700 from 0x8100 (relocation > range: 0x8000-0xbfff) Thanks for reporting! Do you test it on a HDD? I ca

Re: linux-next: build warning after merge of the akpm tree

2017-08-01 Thread Huang, Ying
looks like a false positive reporting and not reported by my compiler and kbuild compiler (gcc-6). But anyway, we should silence it. Best Regards, Huang, Ying -->8-- >From 7a7ff76d7bcbd7affda169b29abcf3dafa38052e Mon Sep 17 00:00:00 2001 From: Huang Ying <ying.hu...@in

Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-09 Thread Huang, Ying
Hi, Andrew, Andrew Morton <a...@linux-foundation.org> writes: > On Mon, 7 Aug 2017 15:21:31 +0800 "Huang, Ying" <ying.hu...@intel.com> wrote: > >> From: Huang Ying <ying.hu...@intel.com> >> >> Huge page helps to reduce TLB miss rate, but

Re: [PATCH -mm -v4 1/5] mm, swap: Add swap readahead hit statistics

2017-08-09 Thread Huang, Ying
Andrew Morton <a...@linux-foundation.org> writes: > On Mon, 7 Aug 2017 13:40:34 +0800 "Huang, Ying" <ying.hu...@intel.com> wrote: > >> From: Huang Ying <ying.hu...@intel.com> >> >> The statistics for total readahead pages and total readahead

Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-07 Thread Huang, Ying
"Kirill A. Shutemov" <kir...@shutemov.name> writes: > On Mon, Aug 07, 2017 at 03:21:31PM +0800, Huang, Ying wrote: >> From: Huang Ying <ying.hu...@intel.com> >> >> Huge page helps to reduce TLB miss rate, but it has higher cache >> footprint,

Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-07 Thread Huang, Ying
Christopher Lameter <c...@linux.com> writes: > On Mon, 7 Aug 2017, Huang, Ying wrote: > >> --- a/mm/memory.c >> +++ b/mm/memory.c >> @@ -4374,9 +4374,31 @@ void clear_huge_page(struct page *page, >> } >> >> might_sleep()

Re: [PATCH -mm -v3 6/6] mm, swap: Don't use VMA based swap readahead if HDD is used as swap

2017-07-25 Thread Huang, Ying
Hi, Andrew, Andrew Morton <a...@linux-foundation.org> writes: > On Tue, 25 Jul 2017 09:51:51 +0800 "Huang, Ying" <ying.hu...@intel.com> wrote: > >> From: Huang Ying <ying.hu...@intel.com> >> >> VMA based swap readahead will readahead th

Re: [PATCH -mm -v3 1/6] mm, swap: Add swap cache statistics sysfs interface

2017-07-25 Thread Huang, Ying
Andrew Morton <a...@linux-foundation.org> writes: > On Tue, 25 Jul 2017 09:51:46 +0800 "Huang, Ying" <ying.hu...@intel.com> wrote: > >> The swap cache stats could be gotten only via sysrq, which isn't >> convenient in some situation. So the sysfs i

Re: [PATCH -mm -v3 1/6] mm, swap: Add swap cache statistics sysfs interface

2017-07-25 Thread Huang, Ying
Hi, Rik, Rik van Riel <r...@redhat.com> writes: > On Tue, 2017-07-25 at 09:51 +0800, Huang, Ying wrote: >> From: Huang Ying <ying.hu...@intel.com> >> >> The swap cache stats could be gotten only via sysrq, which isn't >> convenient in some situation

[PATCH -mm -v4 5/5] mm, swap: Don't use VMA based swap readahead if HDD is used as swap

2017-08-06 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> VMA based swap readahead will readahead the virtual pages that is continuous in the virtual address space. While the original swap readahead will readahead the swap slots that is continuous in the swap device. Although VMA based swap readahead i

[PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-07 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> Huge page helps to reduce TLB miss rate, but it has higher cache footprint, sometimes this may cause some issue. For example, when clearing huge page on x86_64 platform, the cache footprint is 2M. But on a Xeon E5 v3 2699 CPU, there are 18 cor

[PATCH -mm -v4 4/5] mm, swap: Add sysfs interface for VMA based swap readahead

2017-08-06 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The sysfs interface to control the VMA based swap readahead is added as follow, /sys/kernel/mm/swap/vma_ra_enabled Enable the VMA based swap readahead algorithm, or use the original global swap readahead algorithm. /sys/kernel/mm/swap/vma_ra_max

[PATCH -mm -v4 1/5] mm, swap: Add swap readahead hit statistics

2017-08-06 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The statistics for total readahead pages and total readahead hits are recorded and exported via the following sysfs interface. /sys/kernel/mm/swap/ra_hits /sys/kernel/mm/swap/ra_total With them, the efficiency of the swap readahead could be measur

[PATCH -mm -v4 3/5] mm, swap: VMA based swap readahead

2017-08-06 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The swap readahead is an important mechanism to reduce the swap in latency. Although pure sequential memory access pattern isn't very popular for anonymous memory, the space locality is still considered valid. In the original swap readahead implemen

[PATCH -mm -v4 0/5] mm, swap: VMA based swap readahead

2017-08-06 Thread Huang, Ying
statistics, because that is the interface used by other similar statistics. - Add ABI document for newly added sysfs interface. v3: - Rebased on latest -mm tree - Use percpu_counter for swap readahead statistics per Dave Hansen's comment. Best Regards, Huang, Ying

[PATCH -mm -v4 2/5] mm, swap: Fix swap readahead marking

2017-08-06 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> In the original implementation, it is possible that the existing pages in the swap cache (not newly readahead) could be marked as the readahead pages. This will cause the statistics of swap readahead be wrong and influence the swap readahead algorit

Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page

2017-08-07 Thread Huang, Ying
Jan Kara <j...@suse.cz> writes: > On Mon 07-08-17 15:21:31, Huang, Ying wrote: >> From: Huang Ying <ying.hu...@intel.com> >> >> Huge page helps to reduce TLB miss rate, but it has higher cache >> footprint, sometimes this may cause some issue. For exampl

Re: [LKP] [lkp-robot] [sched/fair] 4c77b18cf8: hackbench.throughput -14.4% regression

2017-05-01 Thread Huang, Ying
ust want to get the latest status. Best Regards, Huang, Ying

[PATCH -mm -v11 1/5] mm, THP, swap: Delay splitting THP during swap out

2017-05-15 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> In this patch, splitting huge page is delayed from almost the first step of swapping out to after allocating the swap space for the THP (Transparent Huge Page) and adding the THP into the swap cache. This will batch the corresponding operation, thus i

[PATCH -mm -v11 5/5] mm, THP, swap: Enable THP swap optimization only if has compound map

2017-05-15 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> If there is no compound map for a THP (Transparent Huge Page), it is possible that the map count of some sub-pages of the THP is 0. So it is better to split the THP before swapping out. In this way, the sub-pages not mapped will be freed, and we can

[PATCH -mm -v11 0/5] THP swap: Delay splitting THP during swapping out

2017-05-15 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> This patchset is to optimize the performance of Transparent Huge Page (THP) swap. Recently, the performance of the storage devices improved so fast that we cannot saturate the disk bandwidth with single logical CPU when do page swap out even on a hi

[PATCH -mm -v11 4/5] mm, THP, swap: Check whether THP can be split firstly

2017-05-15 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> To swap out THP (Transparent Huage Page), before splitting the THP, the swap cluster will be allocated and the THP will be added into the swap cache. But it is possible that the THP cannot be split, so that we must delete the THP from the swap

[PATCH -mm -v11 3/5] mm, THP, swap: Move anonymous THP split logic to vmscan

2017-05-15 Thread Huang, Ying
h base page which is more natural. Acked-by: Johannes Weiner <han...@cmpxchg.org> Signed-off-by: Minchan Kim <minc...@kernel.org> Signed-off-by: "Huang, Ying" <ying.hu...@intel.com> --- include/linux/swap.h | 4 ++-- mm/swap_state.c | 23 ++--

[PATCH -mm -v11 2/5] mm, THP, swap: Unify swap slot free functions to put_swap_page

2017-05-15 Thread Huang, Ying
nction depending on page's size. [ying.hu...@intel.com: minor cleanup and fix] Acked-by: Johannes Weiner <han...@cmpxchg.org> Signed-off-by: Minchan Kim <minc...@kernel.org> Signed-off-by: "Huang, Ying" <ying.hu...@intel.com> --- include/linux/swap.h | 12 ++--

Re: [PATCH -mm -v10 1/3] mm, THP, swap: Delay splitting THP during swap out

2017-05-10 Thread Huang, Ying
ansHuge(page) && >> > +split_huge_page_to_list(page, page_list)) { >> > + delete_from_swap_cache(page); >> >goto activate_locked; >> > + } >> >> Pulling this out of add_to_swap() is an improvement for sure. Add an >> XXX: before that "we don't support THP writes" comment for good >> measure :) > > Sure. > > It could be a separate patch which makes add_to_swap clean via > removing page_list argument but I hope Huang take/fold it when he > resend it because it would be more important with THP swap. Sure. I will take this patch as one patch of the THP swap series. Because the first patch of the THP swap series is a little big, I don't think it is a good idea to fold this patch into it. Could you update the patch according to Johannes' comments and resend it? Best Regards, Huang, Ying

[PATCH -mm -v2 02/12] mm, THP, swap: Support to reclaim swap space for THP swapped out

2017-06-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> The normal swap slot reclaiming can be done when the swap count reaches SWAP_HAS_CACHE. But for the swap slot which is backing a THP, all swap slots backing one THP must be reclaimed together, because the swap slot may be used again when the THP is s

[PATCH -mm -v2 06/12] Test code to write THP to swap device as a whole

2017-06-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> To support to delay splitting THP (Transparent Huge Page) after swapped out. We need to enhance swap writing code to support to write a THP as a whole. This will improve swap write IO performance. As Ming Lei <ming@redhat.com>

[PATCH -mm -v2 03/12] mm, THP, swap: Make reuse_swap_page() works for THP swapped out

2017-06-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> After supporting to delay THP (Transparent Huge Page) splitting after swapped out, it is possible that some page table mappings of the THP are turned into swap entries. So reuse_swap_page() need to check the swap count in addition to the map

[PATCH -mm -v2 01/12] mm, THP, swap: Support to clear swap cache flag for THP swapped out

2017-06-23 Thread Huang, Ying
From: Huang Ying <ying.hu...@intel.com> Previously, swapcache_free_cluster() is used only in the error path of shrink_page_list() to free the swap cluster just allocated if the THP (Transparent Huge Page) is failed to be split. In this patch, it is enhanced to clear the swap cach

<    5   6   7   8   9   10   11   12   13   14   >