linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Nhat Pham <nphamcs@gmail.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	bfoster@redhat.com, willy@infradead.org,  kernel-team@meta.com
Subject: Re: [PATCH v5 2/3] cachestat: implement cachestat syscall
Date: Fri, 13 Jan 2023 10:35:57 +0100	[thread overview]
Message-ID: <CAMuHMdXObtC0_US+fpc9Wq0SEHGcmLfVb19F55SF6x=yMKD4UQ@mail.gmail.com> (raw)
In-Reply-To: <20230104231127.2634648-3-nphamcs@gmail.com>

On Thu, Jan 5, 2023 at 12:13 AM Nhat Pham <nphamcs@gmail.com> wrote:
> Implement a new syscall that queries cache state of a file and
> summarizes the number of cached pages, number of dirty pages, number of
> pages marked for writeback, number of (recently) evicted pages, etc. in
> a given range.
>
> NAME
>     cachestat - query the page cache statistics of a file.
>
> SYNOPSIS
>     #include <sys/mman.h>
>
>     struct cachestat {
>         __u64 nr_cache;
>         __u64 nr_dirty;
>         __u64 nr_writeback;
>         __u64 nr_evicted;
>         __u64 nr_recently_evicted;
>     };
>
>     int cachestat(unsigned int fd, off_t off, size_t len,
>           size_t cstat_size, struct cachestat *cstat,
>           unsigned int flags);
>
> DESCRIPTION
>     cachestat() queries the number of cached pages, number of dirty
>     pages, number of pages marked for writeback, number of evicted
>     pages, number of recently evicted pages, in the bytes range given by
>     `off` and `len`.
>
>     An evicted page is a page that is previously in the page cache but
>     has been evicted since. A page is recently evicted if its last
>     eviction was recent enough that its reentry to the cache would
>     indicate that it is actively being used by the system, and that
>     there is memory pressure on the system.
>
>     These values are returned in a cachestat struct, whose address is
>     given by the `cstat` argument.
>
>     The `off` and `len` arguments must be non-negative integers. If
>     `len` > 0, the queried range is [`off`, `off` + `len`]. If `len` ==
>     0, we will query in the range from `off` to the end of the file.
>
>     `cstat_size` allows users to obtain partial results. The syscall
>     will copy the first `csstat_size` bytes to the specified userspace
>     memory. `cstat_size` must be a non-negative value that is no larger
>     than the current size of the cachestat struct.
>
>     The `flags` argument is unused for now, but is included for future
>     extensibility. User should pass 0 (i.e no flag specified).
>
> RETURN VALUE
>     On success, cachestat returns 0. On error, -1 is returned, and errno
>     is set to indicate the error.
>
> ERRORS
>     EFAULT cstat points to an invalid address.
>
>     EINVAL invalid `cstat_size` or `flags`
>
>     EBADF  invalid file descriptor.
>
> Signed-off-by: Nhat Pham <nphamcs@gmail.com>

>  arch/m68k/kernel/syscalls/syscall.tbl       |   1 +

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k]

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


  parent reply	other threads:[~2023-01-13  9:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 23:11 [PATCH v5 0/3] cachestat: a new syscall for page cache state of files Nhat Pham
2023-01-04 23:11 ` [PATCH v5 1/3] workingset: refactor LRU refault to expose refault recency check Nhat Pham
2023-01-04 23:11 ` [PATCH v5 2/3] cachestat: implement cachestat syscall Nhat Pham
2023-01-10 14:22   ` Brian Foster
2023-01-10 21:16     ` Nhat Pham
2023-01-11 12:53       ` Brian Foster
2023-01-11 20:39         ` Nhat Pham
2023-01-11 21:00           ` Brian Foster
2023-01-11 23:53   ` Hillf Danton
2023-01-13  9:35   ` Geert Uytterhoeven [this message]
2023-01-04 23:11 ` [PATCH v5 3/3] selftests: Add selftests for cachestat Nhat Pham
2023-01-04 23:21 ` [PATCH v5 0/3] cachestat: a new syscall for page cache state of files Nhat Pham
  -- strict thread matches above, loose matches on Subject: below --
2023-01-04 23:10 Nhat Pham
2023-01-04 23:10 ` [PATCH v5 2/3] cachestat: implement cachestat syscall Nhat Pham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdXObtC0_US+fpc9Wq0SEHGcmLfVb19F55SF6x=yMKD4UQ@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=bfoster@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox