linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nhat Pham <nphamcs@gmail.com>
To: Brian Foster <bfoster@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	akpm@linux-foundation.org, hannes@cmpxchg.org,
	 linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	willy@infradead.org,  kernel-team@meta.com
Subject: Re: [PATCH v2 3/4] cachestat: implement cachestat syscall
Date: Mon, 12 Dec 2022 08:50:55 -0800	[thread overview]
Message-ID: <CAKEwX=Og2JTWbtpU=n+PVskR8ovNiN-GJwrPoMrbe+q+K_-EBw@mail.gmail.com> (raw)
In-Reply-To: <Y5crEpr5QWptjK17@bfoster>

On Mon, Dec 12, 2022 at 5:22 AM Brian Foster <bfoster@redhat.com> wrote:
>
> On Sat, Dec 10, 2022 at 11:51:32PM +0000, Al Viro wrote:
> > On Mon, Dec 05, 2022 at 09:51:39AM -0800, Nhat Pham wrote:
> >
> > > +   if (!access_ok(cstat, sizeof(struct cachestat)))
> > > +           return -EFAULT;
> >
> > What for?  You are using copy_to_user() later, right?
> >
> > > +   f = fdget(fd);
> > > +   if (f.file) {
> >
> > It would be easier to read if you inverted the condition here.
> >
>
> Seconded.. I mentioned the same the last time I looked at this. On
> looking again, perhaps it might even make sense to create a
> filemap_cachestat() to split up the syscall bits from the associated map
> walking bits..? That subsequently raises the question of whether a new
> .c file is really necessary..
>
> Brian
>

Personally, I think it's better to add a new .c file for the new syscall.
But I'm impartial with respect to the refactoring otherwise. I'll just give it a
shot and see if it looks cleaner.

(BTW - I just realized this is the v2 thread. I have sent out a v3 - feel free
to take a look at that as well! These comments are still valid for the new
version though).


  reply	other threads:[~2022-12-12 16:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 17:51 [PATCH v2 0/4] cachestat: a new syscall for page cache state of files Nhat Pham
2022-12-05 17:51 ` [PATCH v2 1/4] workingset: fix confusion around eviction vs refault container Nhat Pham
2022-12-05 17:51 ` [PATCH v2 2/4] workingset: refactor LRU refault to expose refault recency check Nhat Pham
2022-12-05 23:49   ` Yu Zhao
2022-12-06  1:19     ` Nhat Pham
2022-12-06  1:28       ` Yu Zhao
2022-12-06  2:22         ` Nhat Pham
2022-12-06  2:25           ` Yu Zhao
2022-12-08 18:07             ` Nhat Pham
2022-12-06 15:22   ` Matthew Wilcox
2022-12-07 17:28     ` Nhat Pham
2022-12-05 17:51 ` [PATCH v2 3/4] cachestat: implement cachestat syscall Nhat Pham
2022-12-05 23:15   ` kernel test robot
2022-12-06  4:48   ` kernel test robot
2022-12-06  4:59   ` kernel test robot
2022-12-07  1:42   ` kernel test robot
2022-12-10 23:51   ` Al Viro
2022-12-12 13:22     ` Brian Foster
2022-12-12 16:50       ` Nhat Pham [this message]
2022-12-12 16:23     ` Nhat Pham
2022-12-12 16:24       ` Matthew Wilcox
2022-12-12 16:37         ` Nhat Pham
2022-12-05 17:51 ` [PATCH v2 4/4] selftests: Add selftests for cachestat 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='CAKEwX=Og2JTWbtpU=n+PVskR8ovNiN-GJwrPoMrbe+q+K_-EBw@mail.gmail.com' \
    --to=nphamcs@gmail.com \
    --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=viro@zeniv.linux.org.uk \
    --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