diff for duplicates of <87efwe3as0.fsf@yhuang-dev.intel.com> diff --git a/a/1.txt b/N1/1.txt index 38b02a9..f25da81 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -6,26 +6,26 @@ Tim Chen <tim.c.chen@linux.intel.com> writes: >> Date: Thu, 23 Feb 2017 13:05:20 +0800 >> Subject: [PATCH -v5] mm, swap: Sort swap entries before free >> ->>A +>> >> --- ->> A mm/swapfile.c | 43 ++++++++++++++++++++++++++++++++++++++----- ->> A 1 file changed, 38 insertions(+), 5 deletions(-) +>> mm/swapfile.c | 43 ++++++++++++++++++++++++++++++++++++++----- +>> 1 file changed, 38 insertions(+), 5 deletions(-) >> diff --git a/mm/swapfile.c b/mm/swapfile.c >> index 71890061f653..10e75f9e8ac1 100644 >> --- a/mm/swapfile.c >> +++ b/mm/swapfile.c >> @@ -37,6 +37,7 @@ ->> A #include <linux/swapfile.h> ->> A #include <linux/export.h> ->> A #include <linux/swap_slots.h> +>> #include <linux/swapfile.h> +>> #include <linux/export.h> +>> #include <linux/swap_slots.h> >> +#include <linux/sort.h> ->> A ->> A #include <asm/pgtable.h> ->> A #include <asm/tlbflush.h> +>> +>> #include <asm/pgtable.h> +>> #include <asm/tlbflush.h> >> @@ -1065,20 +1066,52 @@ void swapcache_free(swp_entry_t entry) ->> A } ->> A } ->> A +>> } +>> } +>> >> +static int swp_entry_cmp(const void *ent1, const void *ent2) >> +{ >> + const swp_entry_t *e1 = ent1, *e2 = ent2; @@ -33,9 +33,9 @@ Tim Chen <tim.c.chen@linux.intel.com> writes: >> + return (int)(swp_type(*e1) - swp_type(*e2)); >> +} >> + ->> A void swapcache_free_entries(swp_entry_t *entries, int n) ->> A { ->> A struct swap_info_struct *p, *prev; +>> void swapcache_free_entries(swp_entry_t *entries, int n) +>> { +>> struct swap_info_struct *p, *prev; >> - int i; >> + int i, m; >> + swp_entry_t entry; @@ -46,12 +46,12 @@ Tim Chen <tim.c.chen@linux.intel.com> writes: Yes. That is better! Will do that. ->> A ->> A if (n <= 0) ->> A return; ->> A ->> A prev = NULL; ->> A p = NULL; +>> +>> if (n <= 0) +>> return; +>> +>> prev = NULL; +>> p = NULL; >> - for (i = 0; i < n; ++i) { >> - p = swap_info_get_cont(entries[i], prev); >> - if (p) @@ -95,13 +95,13 @@ Yes. That is better! Will do that. >> + continue; > > The if/continue statement seems incorrect. When swp_type(entry) == prev_swp_type -> we also need to free entry. A The if/continue statement should be deleted. +> we also need to free entry. The if/continue statement should be deleted. > > Say we have 3 entries with swp_type > 1,2,1 > > We will get prev_swp_type as 1 and free the first entry -> and sort the remaining two. A The last entry with +> and sort the remaining two. The last entry with > swp_type 1 will not be freed. The first loop in the function will scan all elements of the array, so @@ -118,16 +118,10 @@ Huang, Ying >> + p = swap_info_get_cont(entry, prev); >> + if (likely(p)) >> + swap_entry_free(p, entry); ->> A prev = p; ->> A } ->> A if (p) +>> prev = p; +>> } +>> if (p) > > Thanks. > > Tim - --- -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 9dfb682..7e21f57 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -11,12 +11,12 @@ "Subject\0Re: [PATCH -mm -v3] mm, swap: Sort swap entries before free\0" "Date\0Thu, 27 Apr 2017 09:21:51 +0800\0" "To\0Tim Chen <tim.c.chen@linux.intel.com>\0" - "Cc\0Huang" + "Cc\0Huang\\" Ying <ying.huang@intel.com> Minchan Kim <minchan@kernel.org> Andrew Morton <akpm@linux-foundation.org> - linux-mm@kvack.org - linux-kernel@vger.kernel.org + <linux-mm@kvack.org> + <linux-kernel@vger.kernel.org> Hugh Dickins <hughd@google.com> Shaohua Li <shli@kernel.org> " Rik van Riel <riel@redhat.com>\0" @@ -30,26 +30,26 @@ ">> Date: Thu, 23 Feb 2017 13:05:20 +0800\n" ">> Subject: [PATCH -v5] mm, swap: Sort swap entries before free\n" ">> \n" - ">>A \n" + ">>\302\240\n" ">> ---\n" - ">> A mm/swapfile.c | 43 ++++++++++++++++++++++++++++++++++++++-----\n" - ">> A 1 file changed, 38 insertions(+), 5 deletions(-)\n" + ">> \302\240mm/swapfile.c | 43 ++++++++++++++++++++++++++++++++++++++-----\n" + ">> \302\2401 file changed, 38 insertions(+), 5 deletions(-)\n" ">> diff --git a/mm/swapfile.c b/mm/swapfile.c\n" ">> index 71890061f653..10e75f9e8ac1 100644\n" ">> --- a/mm/swapfile.c\n" ">> +++ b/mm/swapfile.c\n" ">> @@ -37,6 +37,7 @@\n" - ">> A #include <linux/swapfile.h>\n" - ">> A #include <linux/export.h>\n" - ">> A #include <linux/swap_slots.h>\n" + ">> \302\240#include <linux/swapfile.h>\n" + ">> \302\240#include <linux/export.h>\n" + ">> \302\240#include <linux/swap_slots.h>\n" ">> +#include <linux/sort.h>\n" - ">> A \n" - ">> A #include <asm/pgtable.h>\n" - ">> A #include <asm/tlbflush.h>\n" + ">> \302\240\n" + ">> \302\240#include <asm/pgtable.h>\n" + ">> \302\240#include <asm/tlbflush.h>\n" ">> @@ -1065,20 +1066,52 @@ void swapcache_free(swp_entry_t entry)\n" - ">> A \t}\n" - ">> A }\n" - ">> A \n" + ">> \302\240\t}\n" + ">> \302\240}\n" + ">> \302\240\n" ">> +static int swp_entry_cmp(const void *ent1, const void *ent2)\n" ">> +{\n" ">> +\tconst swp_entry_t *e1 = ent1, *e2 = ent2;\n" @@ -57,9 +57,9 @@ ">> +\treturn (int)(swp_type(*e1) - swp_type(*e2));\n" ">> +}\n" ">> +\n" - ">> A void swapcache_free_entries(swp_entry_t *entries, int n)\n" - ">> A {\n" - ">> A \tstruct swap_info_struct *p, *prev;\n" + ">> \302\240void swapcache_free_entries(swp_entry_t *entries, int n)\n" + ">> \302\240{\n" + ">> \302\240\tstruct swap_info_struct *p, *prev;\n" ">> -\tint i;\n" ">> +\tint i, m;\n" ">> +\tswp_entry_t entry;\n" @@ -70,12 +70,12 @@ "\n" "Yes. That is better! Will do that.\n" "\n" - ">> A \n" - ">> A \tif (n <= 0)\n" - ">> A \t\treturn;\n" - ">> A \n" - ">> A \tprev = NULL;\n" - ">> A \tp = NULL;\n" + ">> \302\240\n" + ">> \302\240\tif (n <= 0)\n" + ">> \302\240\t\treturn;\n" + ">> \302\240\n" + ">> \302\240\tprev = NULL;\n" + ">> \302\240\tp = NULL;\n" ">> -\tfor (i = 0; i < n; ++i) {\n" ">> -\t\tp = swap_info_get_cont(entries[i], prev);\n" ">> -\t\tif (p)\n" @@ -119,13 +119,13 @@ ">> +\t\t\tcontinue;\n" ">\n" "> The if/continue statement seems incorrect. When swp_type(entry) == prev_swp_type\n" - "> we also need to free entry. A The if/continue statement should be deleted.\n" + "> we also need to free entry. \302\240The if/continue statement should be deleted.\n" ">\n" "> Say we have 3 entries with swp_type\n" "> 1,2,1\n" ">\n" "> We will get prev_swp_type as 1 and free the first entry\n" - "> and sort the remaining two. A The last entry with\n" + "> and sort the remaining two. \302\240The last entry with\n" "> swp_type 1 will not be freed.\n" "\n" "The first loop in the function will scan all elements of the array, so\n" @@ -142,18 +142,12 @@ ">> +\t\tp = swap_info_get_cont(entry, prev);\n" ">> +\t\tif (likely(p))\n" ">> +\t\t\tswap_entry_free(p, entry);\n" - ">> A \t\tprev = p;\n" - ">> A \t}\n" - ">> A \tif (p)\n" + ">> \302\240\t\tprev = p;\n" + ">> \302\240\t}\n" + ">> \302\240\tif (p)\n" ">\n" "> Thanks.\n" ">\n" - "> Tim\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>" + > Tim -aa3a6134f3faadf7345b484821ea90df77b81455707edf9c3d51f7f38b385906 +ea6ea14e86d31d235fa730891be2740979f573e2e3913fcaa68fef56890f3370
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.