diff for duplicates of <20190520035254.57579-8-minchan@kernel.org> diff --git a/a/1.txt b/N1/1.txt index e446e40..bf70804 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,90 +1,13 @@ -System could have much faster swap device like zRAM. In that case, swapping -is extremely cheaper than file-IO on the low-end storage. -In this configuration, userspace could handle different strategy for each -kinds of vma. IOW, they want to reclaim anonymous pages by MADV_COLD -while it keeps file-backed pages in inactive LRU by MADV_COOL because -file IO is more expensive in this case so want to keep them in memory -until memory pressure happens. -To support such strategy easier, this patch introduces -MADV_ANONYMOUS_FILTER and MADV_FILE_FILTER options in madvise(2) like -that /proc/<pid>/clear_refs already has supported same filters. -They are filters could be Ored with other existing hints using top two bits -of (int behavior). +On Mon, 20 May 2019 12:52:54 +0900 Minchan Kim wrote: +> +> With that, user could call a process_madvise syscall simply with a entire +> range(0x0 - 0xFFFFFFFFFFFFFFFF) but either of MADV_ANONYMOUS_FILTER and +> MADV_FILE_FILTER so there is no need to call the syscall range by range. +> +Cool. -Once either of them is set, the hint could affect only the interested vma -either anonymous or file-backed. +Look forward to seeing the non-RFC delivery. -With that, user could call a process_madvise syscall simply with a entire -range(0x0 - 0xFFFFFFFFFFFFFFFF) but either of MADV_ANONYMOUS_FILTER and -MADV_FILE_FILTER so there is no need to call the syscall range by range. - -* from v1r2 - * use consistent check with clear_refs to identify anon/file vma - surenb - -* from v1r1 - * use naming "filter" for new madvise option - dancol - -Signed-off-by: Minchan Kim <minchan@kernel.org> ---- - include/uapi/asm-generic/mman-common.h | 5 +++++ - mm/madvise.c | 14 ++++++++++++++ - 2 files changed, 19 insertions(+) - -diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h -index b8e230de84a6..be59a1b90284 100644 ---- a/include/uapi/asm-generic/mman-common.h -+++ b/include/uapi/asm-generic/mman-common.h -@@ -66,6 +66,11 @@ - #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ - #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */ - -+#define MADV_BEHAVIOR_MASK (~(MADV_ANONYMOUS_FILTER|MADV_FILE_FILTER)) -+ -+#define MADV_ANONYMOUS_FILTER (1<<31) /* works for only anonymous vma */ -+#define MADV_FILE_FILTER (1<<30) /* works for only file-backed vma */ -+ - /* compatibility flags */ - #define MAP_FILE 0 - -diff --git a/mm/madvise.c b/mm/madvise.c -index f4f569dac2bd..116131243540 100644 ---- a/mm/madvise.c -+++ b/mm/madvise.c -@@ -1002,7 +1002,15 @@ static int madvise_core(struct task_struct *tsk, unsigned long start, - int write; - size_t len; - struct blk_plug plug; -+ bool anon_only, file_only; - -+ anon_only = behavior & MADV_ANONYMOUS_FILTER; -+ file_only = behavior & MADV_FILE_FILTER; -+ -+ if (anon_only && file_only) -+ return error; -+ -+ behavior = behavior & MADV_BEHAVIOR_MASK; - if (!madvise_behavior_valid(behavior)) - return error; - -@@ -1067,12 +1075,18 @@ static int madvise_core(struct task_struct *tsk, unsigned long start, - if (end < tmp) - tmp = end; - -+ if (anon_only && vma->vm_file) -+ goto next; -+ if (file_only && !vma->vm_file) -+ goto next; -+ - /* Here vma->vm_start <= start < tmp <= (end|vma->vm_end). */ - error = madvise_vma(tsk, vma, &prev, start, tmp, - behavior, &pages); - if (error) - goto out; - *nr_pages += pages; -+next: - start = tmp; - if (prev && start < prev->vm_end) - start = prev->vm_end; --- -2.21.0.1020.gf2820cf01a-goog +BR +Hillf diff --git a/a/content_digest b/N1/content_digest index eecea10..665270d 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,9 +1,10 @@ "ref\020190520035254.57579-1-minchan@kernel.org\0" - "From\0Minchan Kim <minchan@kernel.org>\0" - "Subject\0[RFC 7/7] mm: madvise support MADV_ANONYMOUS_FILTER and MADV_FILE_FILTER\0" - "Date\0Mon, 20 May 2019 12:52:54 +0900\0" - "To\0Andrew Morton <akpm@linux-foundation.org>\0" - "Cc\0LKML <linux-kernel@vger.kernel.org>" + "From\0Hillf Danton <hdanton@sina.com>\0" + "Subject\0Re: [RFC 7/7] mm: madvise support MADV_ANONYMOUS_FILTER and MADV_FILE_FILTER\0" + "Date\0Wed, 29 May 2019 12:36:04 +0800\0" + "To\0Minchan Kim <minchan@kernel.org>\0" + "Cc\0Andrew Morton <akpm@linux-foundation.org>" + LKML <linux-kernel@vger.kernel.org> linux-mm <linux-mm@kvack.org> Michal Hocko <mhocko@suse.com> Johannes Weiner <hannes@cmpxchg.org> @@ -13,99 +14,21 @@ Daniel Colascione <dancol@google.com> Shakeel Butt <shakeelb@google.com> Sonny Rao <sonnyrao@google.com> - Brian Geffon <bgeffon@google.com> - " Minchan Kim <minchan@kernel.org>\0" + " Brian Geffon <bgeffon@google.com>\0" "\00:1\0" "b\0" - "System could have much faster swap device like zRAM. In that case, swapping\n" - "is extremely cheaper than file-IO on the low-end storage.\n" - "In this configuration, userspace could handle different strategy for each\n" - "kinds of vma. IOW, they want to reclaim anonymous pages by MADV_COLD\n" - "while it keeps file-backed pages in inactive LRU by MADV_COOL because\n" - "file IO is more expensive in this case so want to keep them in memory\n" - "until memory pressure happens.\n" "\n" - "To support such strategy easier, this patch introduces\n" - "MADV_ANONYMOUS_FILTER and MADV_FILE_FILTER options in madvise(2) like\n" - "that /proc/<pid>/clear_refs already has supported same filters.\n" - "They are filters could be Ored with other existing hints using top two bits\n" - "of (int behavior).\n" + "On Mon, 20 May 2019 12:52:54 +0900 Minchan Kim wrote:\n" + "> \n" + "> With that, user could call a process_madvise syscall simply with a entire\n" + "> range(0x0 - 0xFFFFFFFFFFFFFFFF) but either of MADV_ANONYMOUS_FILTER and\n" + "> MADV_FILE_FILTER so there is no need to call the syscall range by range.\n" + "> \n" + "Cool.\n" "\n" - "Once either of them is set, the hint could affect only the interested vma\n" - "either anonymous or file-backed.\n" + "Look forward to seeing the non-RFC delivery.\n" "\n" - "With that, user could call a process_madvise syscall simply with a entire\n" - "range(0x0 - 0xFFFFFFFFFFFFFFFF) but either of MADV_ANONYMOUS_FILTER and\n" - "MADV_FILE_FILTER so there is no need to call the syscall range by range.\n" - "\n" - "* from v1r2\n" - " * use consistent check with clear_refs to identify anon/file vma - surenb\n" - "\n" - "* from v1r1\n" - " * use naming \"filter\" for new madvise option - dancol\n" - "\n" - "Signed-off-by: Minchan Kim <minchan@kernel.org>\n" - "---\n" - " include/uapi/asm-generic/mman-common.h | 5 +++++\n" - " mm/madvise.c | 14 ++++++++++++++\n" - " 2 files changed, 19 insertions(+)\n" - "\n" - "diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h\n" - "index b8e230de84a6..be59a1b90284 100644\n" - "--- a/include/uapi/asm-generic/mman-common.h\n" - "+++ b/include/uapi/asm-generic/mman-common.h\n" - "@@ -66,6 +66,11 @@\n" - " #define MADV_WIPEONFORK 18\t\t/* Zero memory on fork, child only */\n" - " #define MADV_KEEPONFORK 19\t\t/* Undo MADV_WIPEONFORK */\n" - " \n" - "+#define MADV_BEHAVIOR_MASK (~(MADV_ANONYMOUS_FILTER|MADV_FILE_FILTER))\n" - "+\n" - "+#define MADV_ANONYMOUS_FILTER\t(1<<31)\t/* works for only anonymous vma */\n" - "+#define MADV_FILE_FILTER\t(1<<30)\t/* works for only file-backed vma */\n" - "+\n" - " /* compatibility flags */\n" - " #define MAP_FILE\t0\n" - " \n" - "diff --git a/mm/madvise.c b/mm/madvise.c\n" - "index f4f569dac2bd..116131243540 100644\n" - "--- a/mm/madvise.c\n" - "+++ b/mm/madvise.c\n" - "@@ -1002,7 +1002,15 @@ static int madvise_core(struct task_struct *tsk, unsigned long start,\n" - " \tint write;\n" - " \tsize_t len;\n" - " \tstruct blk_plug plug;\n" - "+\tbool anon_only, file_only;\n" - " \n" - "+\tanon_only = behavior & MADV_ANONYMOUS_FILTER;\n" - "+\tfile_only = behavior & MADV_FILE_FILTER;\n" - "+\n" - "+\tif (anon_only && file_only)\n" - "+\t\treturn error;\n" - "+\n" - "+\tbehavior = behavior & MADV_BEHAVIOR_MASK;\n" - " \tif (!madvise_behavior_valid(behavior))\n" - " \t\treturn error;\n" - " \n" - "@@ -1067,12 +1075,18 @@ static int madvise_core(struct task_struct *tsk, unsigned long start,\n" - " \t\tif (end < tmp)\n" - " \t\t\ttmp = end;\n" - " \n" - "+\t\tif (anon_only && vma->vm_file)\n" - "+\t\t\tgoto next;\n" - "+\t\tif (file_only && !vma->vm_file)\n" - "+\t\t\tgoto next;\n" - "+\n" - " \t\t/* Here vma->vm_start <= start < tmp <= (end|vma->vm_end). */\n" - " \t\terror = madvise_vma(tsk, vma, &prev, start, tmp,\n" - " \t\t\t\t\tbehavior, &pages);\n" - " \t\tif (error)\n" - " \t\t\tgoto out;\n" - " \t\t*nr_pages += pages;\n" - "+next:\n" - " \t\tstart = tmp;\n" - " \t\tif (prev && start < prev->vm_end)\n" - " \t\t\tstart = prev->vm_end;\n" - "-- \n" - 2.21.0.1020.gf2820cf01a-goog + "BR\n" + Hillf -0bf68695f28e27b6be91bafde0ea08fdc8f86267f84172956c4609009843e9d0 +e4e19a8f43c9c0475c44d76b1e59ed7f2fd185bcdd5745c685da00178788355d
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.