diff mbox series

[v6,15/15] tools headers uapi: add MADV_COLLAPSE madvise mode to tools

Message ID 20220604004004.954674-16-zokeefe@google.com (mailing list archive)
State New
Headers show
Series mm: userspace hugepage collapse | expand

Commit Message

Zach O'Keefe June 4, 2022, 12:40 a.m. UTC
Tools able to translate MADV_COLLAPSE advice to human readable string:

$ tools/perf/trace/beauty/madvise_behavior.sh
static const char *madvise_advices[] = {
        [0] = "NORMAL",
        [1] = "RANDOM",
        [2] = "SEQUENTIAL",
        [3] = "WILLNEED",
        [4] = "DONTNEED",
        [8] = "FREE",
        [9] = "REMOVE",
        [10] = "DONTFORK",
        [11] = "DOFORK",
        [12] = "MERGEABLE",
        [13] = "UNMERGEABLE",
        [14] = "HUGEPAGE",
        [15] = "NOHUGEPAGE",
        [16] = "DONTDUMP",
        [17] = "DODUMP",
        [18] = "WIPEONFORK",
        [19] = "KEEPONFORK",
        [20] = "COLD",
        [21] = "PAGEOUT",
        [22] = "POPULATE_READ",
        [23] = "POPULATE_WRITE",
        [24] = "DONTNEED_LOCKED",
        [25] = "COLLAPSE",
        [100] = "HWPOISON",
        [101] = "SOFT_OFFLINE",
};

Signed-off-by: Zach O'Keefe <zokeefe@google.com>
---
 tools/include/uapi/asm-generic/mman-common.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Yang Shi June 6, 2022, 11:58 p.m. UTC | #1
On Fri, Jun 3, 2022 at 5:40 PM Zach O'Keefe <zokeefe@google.com> wrote:
>
> Tools able to translate MADV_COLLAPSE advice to human readable string:
>
> $ tools/perf/trace/beauty/madvise_behavior.sh
> static const char *madvise_advices[] = {
>         [0] = "NORMAL",
>         [1] = "RANDOM",
>         [2] = "SEQUENTIAL",
>         [3] = "WILLNEED",
>         [4] = "DONTNEED",
>         [8] = "FREE",
>         [9] = "REMOVE",
>         [10] = "DONTFORK",
>         [11] = "DOFORK",
>         [12] = "MERGEABLE",
>         [13] = "UNMERGEABLE",
>         [14] = "HUGEPAGE",
>         [15] = "NOHUGEPAGE",
>         [16] = "DONTDUMP",
>         [17] = "DODUMP",
>         [18] = "WIPEONFORK",
>         [19] = "KEEPONFORK",
>         [20] = "COLD",
>         [21] = "PAGEOUT",
>         [22] = "POPULATE_READ",
>         [23] = "POPULATE_WRITE",
>         [24] = "DONTNEED_LOCKED",
>         [25] = "COLLAPSE",
>         [100] = "HWPOISON",
>         [101] = "SOFT_OFFLINE",
> };
>
> Signed-off-by: Zach O'Keefe <zokeefe@google.com>
> ---
>  tools/include/uapi/asm-generic/mman-common.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h
> index 6c1aa92a92e4..6ce1f1ceb432 100644
> --- a/tools/include/uapi/asm-generic/mman-common.h
> +++ b/tools/include/uapi/asm-generic/mman-common.h
> @@ -77,6 +77,8 @@
>
>  #define MADV_DONTNEED_LOCKED   24      /* like DONTNEED, but drop locked pages too */
>
> +#define MADV_COLLAPSE  25              /* Synchronous hugepage collapse */

I think this patch could be squashed into patch #9?

> +
>  /* compatibility flags */
>  #define MAP_FILE       0
>
> --
> 2.36.1.255.ge46751e96f-goog
>
Zach O'Keefe June 7, 2022, 12:24 a.m. UTC | #2
On Mon, Jun 6, 2022 at 4:58 PM Yang Shi <shy828301@gmail.com> wrote:
>
> On Fri, Jun 3, 2022 at 5:40 PM Zach O'Keefe <zokeefe@google.com> wrote:
> >
> > Tools able to translate MADV_COLLAPSE advice to human readable string:
> >
> > $ tools/perf/trace/beauty/madvise_behavior.sh
> > static const char *madvise_advices[] = {
> >         [0] = "NORMAL",
> >         [1] = "RANDOM",
> >         [2] = "SEQUENTIAL",
> >         [3] = "WILLNEED",
> >         [4] = "DONTNEED",
> >         [8] = "FREE",
> >         [9] = "REMOVE",
> >         [10] = "DONTFORK",
> >         [11] = "DOFORK",
> >         [12] = "MERGEABLE",
> >         [13] = "UNMERGEABLE",
> >         [14] = "HUGEPAGE",
> >         [15] = "NOHUGEPAGE",
> >         [16] = "DONTDUMP",
> >         [17] = "DODUMP",
> >         [18] = "WIPEONFORK",
> >         [19] = "KEEPONFORK",
> >         [20] = "COLD",
> >         [21] = "PAGEOUT",
> >         [22] = "POPULATE_READ",
> >         [23] = "POPULATE_WRITE",
> >         [24] = "DONTNEED_LOCKED",
> >         [25] = "COLLAPSE",
> >         [100] = "HWPOISON",
> >         [101] = "SOFT_OFFLINE",
> > };
> >
> > Signed-off-by: Zach O'Keefe <zokeefe@google.com>
> > ---
> >  tools/include/uapi/asm-generic/mman-common.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h
> > index 6c1aa92a92e4..6ce1f1ceb432 100644
> > --- a/tools/include/uapi/asm-generic/mman-common.h
> > +++ b/tools/include/uapi/asm-generic/mman-common.h
> > @@ -77,6 +77,8 @@
> >
> >  #define MADV_DONTNEED_LOCKED   24      /* like DONTNEED, but drop locked pages too */
> >
> > +#define MADV_COLLAPSE  25              /* Synchronous hugepage collapse */
>
> I think this patch could be squashed into patch #9?

Sure, SGTM.  Was just trying to follow what has been done with e.g.
MADV_DONTNEED_LOCKED ; but I see no reason to not squash. Done.

> > +
> >  /* compatibility flags */
> >  #define MAP_FILE       0
> >
> > --
> > 2.36.1.255.ge46751e96f-goog
> >
diff mbox series

Patch

diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h
index 6c1aa92a92e4..6ce1f1ceb432 100644
--- a/tools/include/uapi/asm-generic/mman-common.h
+++ b/tools/include/uapi/asm-generic/mman-common.h
@@ -77,6 +77,8 @@ 
 
 #define MADV_DONTNEED_LOCKED	24	/* like DONTNEED, but drop locked pages too */
 
+#define MADV_COLLAPSE	25		/* Synchronous hugepage collapse */
+
 /* compatibility flags */
 #define MAP_FILE	0