diff for duplicates of <1493237623.3209.142.camel@linux.intel.com> diff --git a/a/1.txt b/N1/1.txt index e47cca8..88d1d21 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -5,26 +5,26 @@ > 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; @@ -32,9 +32,9 @@ > + 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; @@ -43,12 +43,12 @@ I think it will be clearer to name prev_swp_type as first_swp_type as this is the swp type of the first entry. -> 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) @@ -92,28 +92,22 @@ Can eliminate prev=NULL if we adopt the above change. > + 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. > + 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 0f3cd50..18a3ef9 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -27,26 +27,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" @@ -54,9 +54,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" @@ -65,12 +65,12 @@ "I think it will be clearer to name prev_swp_type as first_swp_type\n" "as this is the swp type of the first entry.\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" @@ -114,30 +114,24 @@ "> +\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" "> +\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 -56a2b91c752c430b4e2fb39c39d71f8fb5fd667984ae197e1e39d1971fd8e4ce +f4a7128fb66a1834f7cda151b2fcb0354fca75d54a8ffdc601aa5c7cb74dfae6
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.