diff for duplicates of <87a88ne4vf.fsf@yhuang-dev.intel.com> diff --git a/a/1.txt b/N1/1.txt index cbd6308..11b2c58 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -4,15 +4,15 @@ Tim Chen <tim.c.chen@linux.intel.com> writes: >> From: Huang Ying <ying.huang@intel.com> >> >> __swapcache_free() is added to support to clear the SWAP_HAS_CACHE flag ->> for the huge page.A A This will free the specified swap cluster now. +>> 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 allocated.A A So the corresponding swap_map[i] == ->> SWAP_HAS_CACHE, that is, the swap count is 0.A A This makes the +>> the swap cluster just allocated. So the corresponding swap_map[i] == +>> SWAP_HAS_CACHE, that is, the swap count is 0. This makes the >> implementation simpler than that of the ordinary swap entry. >> >> This will be used for delaying splitting THP (Transparent Huge Page) ->> during swapping out.A A Where for one THP to swap out, we will allocate a ->> swap cluster, add the THP into the swap cache, then split the THP.A A If +>> during swapping out. Where for one THP to swap out, we will allocate a +>> swap cluster, add the THP into the swap cache, then split the THP. If >> anything fails after allocating the swap cluster and before splitting >> the THP successfully, the swapcache_free_trans_huge() will be used to >> free the swap space allocated. @@ -25,54 +25,54 @@ Tim Chen <tim.c.chen@linux.intel.com> writes: >> Cc: Rik van Riel <riel@redhat.com> >> Signed-off-by: "Huang, Ying" <ying.huang@intel.com> >> --- ->> A include/linux/swap.h |A A 9 +++++++-- ->> A mm/swapfile.cA A A A A A A A | 34 ++++++++++++++++++++++++++++++++-- ->> A 2 files changed, 39 insertions(+), 4 deletions(-) +>> include/linux/swap.h | 9 +++++++-- +>> mm/swapfile.c | 34 ++++++++++++++++++++++++++++++++-- +>> 2 files changed, 39 insertions(+), 4 deletions(-) >> >> diff --git a/include/linux/swap.h b/include/linux/swap.h >> index e3a7609a8989..2f2a6c0363aa 100644 >> --- a/include/linux/swap.h >> +++ b/include/linux/swap.h >> @@ -394,7 +394,7 @@ extern void swap_shmem_alloc(swp_entry_t); ->> A extern int swap_duplicate(swp_entry_t); ->> A extern int swapcache_prepare(swp_entry_t); ->> A extern void swap_free(swp_entry_t); +>> extern int swap_duplicate(swp_entry_t); +>> extern int swapcache_prepare(swp_entry_t); +>> extern void swap_free(swp_entry_t); >> -extern void swapcache_free(swp_entry_t); >> +extern void __swapcache_free(swp_entry_t entry, bool huge); ->> A extern void swapcache_free_entries(swp_entry_t *entries, int n); ->> A extern int free_swap_and_cache(swp_entry_t); ->> A extern int swap_type_of(dev_t, sector_t, struct block_device **); +>> extern void swapcache_free_entries(swp_entry_t *entries, int n); +>> extern int free_swap_and_cache(swp_entry_t); +>> extern int swap_type_of(dev_t, sector_t, struct block_device **); >> @@ -456,7 +456,7 @@ static inline void swap_free(swp_entry_t swp) ->> A { ->> A } ->> A +>> { +>> } +>> >> -static inline void swapcache_free(swp_entry_t swp) >> +static inline void __swapcache_free(swp_entry_t swp, bool huge) ->> A { ->> A } ->> A +>> { +>> } +>> >> @@ -544,6 +544,11 @@ static inline swp_entry_t get_huge_swap_page(void) ->> A } ->> A #endif ->> A +>> } +>> #endif +>> >> +static inline void swapcache_free(swp_entry_t entry) >> +{ >> + __swapcache_free(entry, false); >> +} >> + ->> A #ifdef CONFIG_MEMCG ->> A static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) ->> A { +>> #ifdef CONFIG_MEMCG +>> static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) +>> { >> diff --git a/mm/swapfile.c b/mm/swapfile.c >> index 7241c937e52b..6019f94afbaf 100644 >> --- a/mm/swapfile.c >> +++ b/mm/swapfile.c >> @@ -855,6 +855,29 @@ static void swap_free_huge_cluster(struct swap_info_struct *si, ->> A _swap_entry_free(si, offset, true); ->> A } ->> A +>> _swap_entry_free(si, offset, true); +>> } +>> >> +static void swapcache_free_trans_huge(struct swap_info_struct *si, ->> + A A A A A A swp_entry_t entry) +>> + swp_entry_t entry) >> +{ >> + unsigned long offset = swp_offset(entry); >> + unsigned long idx = offset / SWAPFILE_CLUSTER; @@ -88,15 +88,9 @@ Tim Chen <tim.c.chen@linux.intel.com> writes: >> + map[i] &= ~SWAP_HAS_CACHE; > > Nitpicking a bit: -> map[i] = 0 A is more readable if map[i] == SWAP_HAS_CACHE here. +> map[i] = 0 is more readable if map[i] == SWAP_HAS_CACHE here. OK. I will change this. Best Regards, Huang, Ying - --- -To unsubscribe, send a message with 'unsubscribe linux-mm' in -the body to majordomo@kvack.org. For more info on Linux MM, -see: http://www.linux-mm.org/ . -Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> diff --git a/a/content_digest b/N1/content_digest index 3e5a7c9..20265bb 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -5,11 +5,11 @@ "Subject\0Re: [PATCH -mm -v6 5/9] mm, THP, swap: Support to clear SWAP_HAS_CACHE for huge page\0" "Date\0Wed, 15 Mar 2017 08:54:44 +0800\0" "To\0Tim Chen <tim.c.chen@linux.intel.com>\0" - "Cc\0Huang" + "Cc\0Huang\\" Ying <ying.huang@intel.com> Andrew Morton <akpm@linux-foundation.org> - linux-mm@kvack.org - linux-kernel@vger.kernel.org + <linux-mm@kvack.org> + <linux-kernel@vger.kernel.org> Andrea Arcangeli <aarcange@redhat.com> Kirill A . Shutemov <kirill.shutemov@linux.intel.com> Hugh Dickins <hughd@google.com> @@ -24,15 +24,15 @@ ">> From: Huang Ying <ying.huang@intel.com>\n" ">> \n" ">> __swapcache_free() is added to support to clear the SWAP_HAS_CACHE flag\n" - ">> for the huge page.A A This will free the specified swap cluster now.\n" + ">> for the huge page.\302\240\302\240This will free the specified swap cluster now.\n" ">> Because now this function will be called only in the error path to free\n" - ">> the swap cluster just allocated.A A So the corresponding swap_map[i] ==\n" - ">> SWAP_HAS_CACHE, that is, the swap count is 0.A A This makes the\n" + ">> the swap cluster just allocated.\302\240\302\240So the corresponding swap_map[i] ==\n" + ">> SWAP_HAS_CACHE, that is, the swap count is 0.\302\240\302\240This makes the\n" ">> implementation simpler than that of the ordinary swap entry.\n" ">> \n" ">> This will be used for delaying splitting THP (Transparent Huge Page)\n" - ">> during swapping out.A A Where for one THP to swap out, we will allocate a\n" - ">> swap cluster, add the THP into the swap cache, then split the THP.A A If\n" + ">> during swapping out.\302\240\302\240Where for one THP to swap out, we will allocate a\n" + ">> swap cluster, add the THP into the swap cache, then split the THP.\302\240\302\240If\n" ">> anything fails after allocating the swap cluster and before splitting\n" ">> the THP successfully, the swapcache_free_trans_huge() will be used to\n" ">> free the swap space allocated.\n" @@ -45,54 +45,54 @@ ">> Cc: Rik van Riel <riel@redhat.com>\n" ">> Signed-off-by: \"Huang, Ying\" <ying.huang@intel.com>\n" ">> ---\n" - ">> A include/linux/swap.h |A A 9 +++++++--\n" - ">> A mm/swapfile.cA A A A A A A A | 34 ++++++++++++++++++++++++++++++++--\n" - ">> A 2 files changed, 39 insertions(+), 4 deletions(-)\n" + ">> \302\240include/linux/swap.h |\302\240\302\2409 +++++++--\n" + ">> \302\240mm/swapfile.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240| 34 ++++++++++++++++++++++++++++++++--\n" + ">> \302\2402 files changed, 39 insertions(+), 4 deletions(-)\n" ">> \n" ">> diff --git a/include/linux/swap.h b/include/linux/swap.h\n" ">> index e3a7609a8989..2f2a6c0363aa 100644\n" ">> --- a/include/linux/swap.h\n" ">> +++ b/include/linux/swap.h\n" ">> @@ -394,7 +394,7 @@ extern void swap_shmem_alloc(swp_entry_t);\n" - ">> A extern int swap_duplicate(swp_entry_t);\n" - ">> A extern int swapcache_prepare(swp_entry_t);\n" - ">> A extern void swap_free(swp_entry_t);\n" + ">> \302\240extern int swap_duplicate(swp_entry_t);\n" + ">> \302\240extern int swapcache_prepare(swp_entry_t);\n" + ">> \302\240extern void swap_free(swp_entry_t);\n" ">> -extern void swapcache_free(swp_entry_t);\n" ">> +extern void __swapcache_free(swp_entry_t entry, bool huge);\n" - ">> A extern void swapcache_free_entries(swp_entry_t *entries, int n);\n" - ">> A extern int free_swap_and_cache(swp_entry_t);\n" - ">> A extern int swap_type_of(dev_t, sector_t, struct block_device **);\n" + ">> \302\240extern void swapcache_free_entries(swp_entry_t *entries, int n);\n" + ">> \302\240extern int free_swap_and_cache(swp_entry_t);\n" + ">> \302\240extern int swap_type_of(dev_t, sector_t, struct block_device **);\n" ">> @@ -456,7 +456,7 @@ static inline void swap_free(swp_entry_t swp)\n" - ">> A {\n" - ">> A }\n" - ">> A \n" + ">> \302\240{\n" + ">> \302\240}\n" + ">> \302\240\n" ">> -static inline void swapcache_free(swp_entry_t swp)\n" ">> +static inline void __swapcache_free(swp_entry_t swp, bool huge)\n" - ">> A {\n" - ">> A }\n" - ">> A \n" + ">> \302\240{\n" + ">> \302\240}\n" + ">> \302\240\n" ">> @@ -544,6 +544,11 @@ static inline swp_entry_t get_huge_swap_page(void)\n" - ">> A }\n" - ">> A #endif\n" - ">> A \n" + ">> \302\240}\n" + ">> \302\240#endif\n" + ">> \302\240\n" ">> +static inline void swapcache_free(swp_entry_t entry)\n" ">> +{\n" ">> +\t__swapcache_free(entry, false);\n" ">> +}\n" ">> +\n" - ">> A #ifdef CONFIG_MEMCG\n" - ">> A static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)\n" - ">> A {\n" + ">> \302\240#ifdef CONFIG_MEMCG\n" + ">> \302\240static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)\n" + ">> \302\240{\n" ">> diff --git a/mm/swapfile.c b/mm/swapfile.c\n" ">> index 7241c937e52b..6019f94afbaf 100644\n" ">> --- a/mm/swapfile.c\n" ">> +++ b/mm/swapfile.c\n" ">> @@ -855,6 +855,29 @@ static void swap_free_huge_cluster(struct swap_info_struct *si,\n" - ">> A \t_swap_entry_free(si, offset, true);\n" - ">> A }\n" - ">> A \n" + ">> \302\240\t_swap_entry_free(si, offset, true);\n" + ">> \302\240}\n" + ">> \302\240\n" ">> +static void swapcache_free_trans_huge(struct swap_info_struct *si,\n" - ">> +\t\t\t\tA A A A A A swp_entry_t entry)\n" + ">> +\t\t\t\t\302\240\302\240\302\240\302\240\302\240\302\240swp_entry_t entry)\n" ">> +{\n" ">> +\tunsigned long offset = swp_offset(entry);\n" ">> +\tunsigned long idx = offset / SWAPFILE_CLUSTER;\n" @@ -108,17 +108,11 @@ ">> +\t\tmap[i] &= ~SWAP_HAS_CACHE;\n" ">\n" "> Nitpicking a bit:\n" - "> map[i] = 0 A is more readable if map[i] == SWAP_HAS_CACHE here.\n" + "> map[i] = 0 \302\240is more readable if map[i] == SWAP_HAS_CACHE here.\n" "\n" "OK. I will change this.\n" "\n" "Best Regards,\n" - "Huang, Ying\n" - "\n" - "--\n" - "To unsubscribe, send a message with 'unsubscribe linux-mm' in\n" - "the body to majordomo@kvack.org. For more info on Linux MM,\n" - "see: http://www.linux-mm.org/ .\n" - "Don't email: <a href=mailto:\"dont@kvack.org\"> email@kvack.org </a>" + Huang, Ying -646942b2b810cfda969c7120bcd7cc2f5ac4bea6a393eec88d641ffe5f220276 +9295f6926c49ca5bb48e9b78e563f8ed1653946207001e2fdf52129d2612cf50
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.