diff for duplicates of <20140620030002.GA14884@bbox> diff --git a/a/1.txt b/N1/1.txt index 4765da6..7453e5c 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -84,3 +84,114 @@ https://lkml.org/lkml/2014/6/16/750 Anyway, push this patch firstly. ================= &< ================= + +>From b1fd007097064db34a211ffeacfe4da9fb22d49e Mon Sep 17 00:00:00 2001 +From: Minchan Kim <minchan@kernel.org> +Date: Fri, 20 Jun 2014 11:37:52 +0900 +Subject: [PATCH] mm: Write down design and intentions in English for + proportial scan + +Quote from Andrew +" +That code is absolutely awful :( It's terribly difficult to work out +what the design is - what the code is actually setting out to achieve. +One is reduced to trying to reverse-engineer the intent from the +implementation and that becomes near impossible when the +implementation has bugs! + +<snip> + +The only way we're going to fix all this up is to stop looking at the +code altogether. Write down the design and the intentions in English. +Review that. Then implement that design in C +" + +One thing I know it might not be English Andrew expected but other +thing I know is there are lots of native people in here so one of them +will spend his time to make this horrible English smooth. + +I alreday spent my time to try to fix this situation so it's your +turn. It's good time balance between non-native and native people +so open source community is fair for all of us. + +Signed-off-by: Minchan Kim <minchan@kernel.org> +--- + mm/vmscan.c | 37 +++++++++++++++++++++++++++++++------ + 1 file changed, 31 insertions(+), 6 deletions(-) + +diff --git a/mm/vmscan.c b/mm/vmscan.c +index 521f7eab1798..3a9862895a64 100644 +--- a/mm/vmscan.c ++++ b/mm/vmscan.c +@@ -2071,6 +2071,22 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) + + get_scan_count(lruvec, sc, nr); + ++ /* ++ * Basically, VM scans file/anon LRU list proportionally depending ++ * on the value of vm.swappiness but doesn't want to reclaim ++ * excessive pages. So, it might be better to stop scan as soon as ++ * we meet nr_to_reclaim but it breaks aging balance between LRU lists ++ * To keep the balance, what we do is as follows. ++ * ++ * If we reclaim pages requested, we stop scanning first and ++ * investigate which LRU should be scanned more depending on ++ * remained lru size(ie, nr[xxx]). We will scan bigger one more ++ * so, final goal is ++ * ++ * scanned[xxx] = targets[xxx] - nr[xxx] ++ * targets[anon] : targets[file] = scanned[anon] : scanned[file] ++ */ ++ + /* Record the original scan target for proportional adjustments later */ + memcpy(targets, nr, sizeof(nr)); + +@@ -2091,8 +2107,14 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) + blk_start_plug(&plug); + while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] || + nr[LRU_INACTIVE_FILE]) { +- unsigned long nr_anon, nr_file, percentage; ++ unsigned long nr_anon, nr_file; + unsigned long nr_scanned; ++ /* ++ * How many pages we should scan to meet target ++ * calculated by get_scan_count. It means that ++ * (100 - percentage) = already scanned ratio ++ */ ++ unsigned percentage; + + for_each_evictable_lru(lru) { + if (nr[lru]) { +@@ -2108,11 +2130,10 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) + continue; + + /* +- * For kswapd and memcg, reclaim at least the number of pages +- * requested. Ensure that the anon and file LRUs are scanned +- * proportionally what was requested by get_scan_count(). We +- * stop reclaiming one LRU and reduce the amount scanning +- * proportional to the original scan target. ++ * Here, we reclaimed at least the number of pages requested. ++ * Then, what we should do is the ensure that the anon and ++ * file LRUs are scanned proportionally what was requested ++ * by get_scan_count(). + */ + nr_file = nr[LRU_INACTIVE_FILE] + nr[LRU_ACTIVE_FILE]; + nr_anon = nr[LRU_INACTIVE_ANON] + nr[LRU_ACTIVE_ANON]; +@@ -2126,6 +2147,10 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) + if (!nr_file || !nr_anon) + break; + ++ /* ++ * Scan the bigger of the LRU more while stop scanning ++ * the smaller of the LRU to keep aging balance between LRUs ++ */ + if (nr_file > nr_anon) { + unsigned long scan_target = targets[LRU_INACTIVE_ANON] + + targets[LRU_ACTIVE_ANON] + 1; +-- +2.0.0 + +-- +Kind regards, +Minchan Kim diff --git a/a/content_digest b/N1/content_digest index 76840e5..175880a 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -96,6 +96,117 @@ "\n" "Anyway, push this patch firstly.\n" "\n" - ================= &< ================= + "================= &< =================\n" + "\n" + ">From b1fd007097064db34a211ffeacfe4da9fb22d49e Mon Sep 17 00:00:00 2001\n" + "From: Minchan Kim <minchan@kernel.org>\n" + "Date: Fri, 20 Jun 2014 11:37:52 +0900\n" + "Subject: [PATCH] mm: Write down design and intentions in English for\n" + " proportial scan\n" + "\n" + "Quote from Andrew\n" + "\"\n" + "That code is absolutely awful :( It's terribly difficult to work out\n" + "what the design is - what the code is actually setting out to achieve.\n" + "One is reduced to trying to reverse-engineer the intent from the\n" + "implementation and that becomes near impossible when the\n" + "implementation has bugs!\n" + "\n" + "<snip>\n" + "\n" + "The only way we're going to fix all this up is to stop looking at the\n" + "code altogether. Write down the design and the intentions in English.\n" + "Review that. Then implement that design in C\n" + "\"\n" + "\n" + "One thing I know it might not be English Andrew expected but other\n" + "thing I know is there are lots of native people in here so one of them\n" + "will spend his time to make this horrible English smooth.\n" + "\n" + "I alreday spent my time to try to fix this situation so it's your\n" + "turn. It's good time balance between non-native and native people\n" + "so open source community is fair for all of us.\n" + "\n" + "Signed-off-by: Minchan Kim <minchan@kernel.org>\n" + "---\n" + " mm/vmscan.c | 37 +++++++++++++++++++++++++++++++------\n" + " 1 file changed, 31 insertions(+), 6 deletions(-)\n" + "\n" + "diff --git a/mm/vmscan.c b/mm/vmscan.c\n" + "index 521f7eab1798..3a9862895a64 100644\n" + "--- a/mm/vmscan.c\n" + "+++ b/mm/vmscan.c\n" + "@@ -2071,6 +2071,22 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)\n" + " \n" + " \tget_scan_count(lruvec, sc, nr);\n" + " \n" + "+\t/*\n" + "+\t * Basically, VM scans file/anon LRU list proportionally depending\n" + "+\t * on the value of vm.swappiness but doesn't want to reclaim\n" + "+\t * excessive pages. So, it might be better to stop scan as soon as\n" + "+\t * we meet nr_to_reclaim but it breaks aging balance between LRU lists\n" + "+\t * To keep the balance, what we do is as follows.\n" + "+\t *\n" + "+\t * If we reclaim pages requested, we stop scanning first and\n" + "+\t * investigate which LRU should be scanned more depending on\n" + "+\t * remained lru size(ie, nr[xxx]). We will scan bigger one more\n" + "+\t * so, final goal is\n" + "+\t *\n" + "+\t * scanned[xxx] = targets[xxx] - nr[xxx]\n" + "+\t * targets[anon] : targets[file] = scanned[anon] : scanned[file]\n" + "+\t */\n" + "+\n" + " \t/* Record the original scan target for proportional adjustments later */\n" + " \tmemcpy(targets, nr, sizeof(nr));\n" + " \n" + "@@ -2091,8 +2107,14 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)\n" + " \tblk_start_plug(&plug);\n" + " \twhile (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] ||\n" + " \t\t\t\t\tnr[LRU_INACTIVE_FILE]) {\n" + "-\t\tunsigned long nr_anon, nr_file, percentage;\n" + "+\t\tunsigned long nr_anon, nr_file;\n" + " \t\tunsigned long nr_scanned;\n" + "+\t\t/*\n" + "+\t\t * How many pages we should scan to meet target\n" + "+\t\t * calculated by get_scan_count. It means that\n" + "+\t\t * (100 - percentage) = already scanned ratio\n" + "+\t\t */\n" + "+\t\tunsigned percentage;\n" + " \n" + " \t\tfor_each_evictable_lru(lru) {\n" + " \t\t\tif (nr[lru]) {\n" + "@@ -2108,11 +2130,10 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)\n" + " \t\t\tcontinue;\n" + " \n" + " \t\t/*\n" + "-\t\t * For kswapd and memcg, reclaim at least the number of pages\n" + "-\t\t * requested. Ensure that the anon and file LRUs are scanned\n" + "-\t\t * proportionally what was requested by get_scan_count(). We\n" + "-\t\t * stop reclaiming one LRU and reduce the amount scanning\n" + "-\t\t * proportional to the original scan target.\n" + "+\t\t * Here, we reclaimed at least the number of pages requested.\n" + "+\t\t * Then, what we should do is the ensure that the anon and\n" + "+\t\t * file LRUs are scanned proportionally what was requested\n" + "+\t\t * by get_scan_count().\n" + " \t\t */\n" + " \t\tnr_file = nr[LRU_INACTIVE_FILE] + nr[LRU_ACTIVE_FILE];\n" + " \t\tnr_anon = nr[LRU_INACTIVE_ANON] + nr[LRU_ACTIVE_ANON];\n" + "@@ -2126,6 +2147,10 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)\n" + " \t\tif (!nr_file || !nr_anon)\n" + " \t\t\tbreak;\n" + " \n" + "+\t\t/*\n" + "+\t\t * Scan the bigger of the LRU more while stop scanning\n" + "+\t\t * the smaller of the LRU to keep aging balance between LRUs\n" + "+\t\t */\n" + " \t\tif (nr_file > nr_anon) {\n" + " \t\t\tunsigned long scan_target = targets[LRU_INACTIVE_ANON] +\n" + " \t\t\t\t\t\ttargets[LRU_ACTIVE_ANON] + 1;\n" + "-- \n" + "2.0.0\n" + "\n" + "-- \n" + "Kind regards,\n" + Minchan Kim -08f954487c43804ce1a1020a3c8915d329ac57ecf34b9a948c78857cd51e8f69 +ba013f6c3ce0cadf2e008ef284079352051eb893d17af4471f14be5daaf9ef9b
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.