From: Daniel Jordan <daniel.m.jordan@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
Alan Tull <atull@kernel.org>,
Alex Williamson <alex.williamson@redhat.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Christoph Lameter <cl@linux.com>,
Christophe Leroy <christophe.leroy@c-s.fr>,
Davidlohr Bueso <dave@stgolabs.net>,
Jason Gunthorpe <jgg@mellanox.com>,
Mark Rutland <mark.rutland@arm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Moritz Fischer <mdf@kernel.org>,
Paul Mackerras <paulus@ozlabs.org>,
Steve Sistare <steven.sistare@oracle.com>,
Wu Hao <hao.wu@intel.com>,
linux-mm@kvack.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-fpga@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: add account_locked_vm utility function
Date: Tue, 28 May 2019 11:04:24 -0400 [thread overview]
Message-ID: <20190528150424.tjbaiptpjhzg7y75@ca-dmjordan1.us.oracle.com> (raw)
In-Reply-To: <20190525145118.bfda2d75a14db05a001e49ad@linux-foundation.org>
On Sat, May 25, 2019 at 02:51:18PM -0700, Andrew Morton wrote:
> On Fri, 24 May 2019 13:50:45 -0400 Daniel Jordan <daniel.m.jordan@oracle.com> wrote:
>
> > locked_vm accounting is done roughly the same way in five places, so
> > unify them in a helper. Standardize the debug prints, which vary
> > slightly, but include the helper's caller to disambiguate between
> > callsites.
> >
> > Error codes stay the same, so user-visible behavior does too. The one
> > exception is that the -EPERM case in tce_account_locked_vm is removed
> > because Alexey has never seen it triggered.
> >
> > ...
> >
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
> > @@ -1564,6 +1564,25 @@ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
> > int get_user_pages_fast(unsigned long start, int nr_pages,
> > unsigned int gup_flags, struct page **pages);
> >
> > +int __account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc,
> > + struct task_struct *task, bool bypass_rlim);
> > +
> > +static inline int account_locked_vm(struct mm_struct *mm, unsigned long pages,
> > + bool inc)
> > +{
> > + int ret;
> > +
> > + if (pages == 0 || !mm)
> > + return 0;
> > +
> > + down_write(&mm->mmap_sem);
> > + ret = __account_locked_vm(mm, pages, inc, current,
> > + capable(CAP_IPC_LOCK));
> > + up_write(&mm->mmap_sem);
> > +
> > + return ret;
> > +}
>
> That's quite a mouthful for an inlined function. How about uninlining
> the whole thing and fiddling drivers/vfio/vfio_iommu_type1.c to suit.
> I wonder why it does down_write_killable and whether it really needs
> to...
Sure, I can uninline it. vfio changelogs don't show a particular reason for
_killable[1]. Maybe Alex has something to add. Otherwise I'll respin without
it since the simplification seems worth removing _killable.
[1] 0cfef2b7410b ("vfio/type1: Remove locked page accounting workqueue")
next prev parent reply other threads:[~2019-05-28 15:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 20:16 [PATCH] mm: add account_locked_vm utility function Daniel Jordan
2019-05-03 23:28 ` Jason Gunthorpe
2019-05-07 3:09 ` Daniel Jordan
2019-05-20 6:19 ` Alexey Kardashevskiy
2019-05-20 15:30 ` Daniel Jordan
2019-05-24 6:43 ` Alexey Kardashevskiy
2019-05-24 17:50 ` [PATCH v2] " Daniel Jordan
2019-05-25 21:51 ` Andrew Morton
2019-05-28 15:04 ` Daniel Jordan [this message]
2019-05-29 18:56 ` Alex Williamson
2019-05-29 20:50 ` [PATCH v3] " Daniel Jordan
2019-06-03 19:15 ` Alex Williamson
2019-05-29 18:05 ` [PATCH v2] " Ira Weiny
2019-05-29 18:35 ` Daniel Jordan
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=20190528150424.tjbaiptpjhzg7y75@ca-dmjordan1.us.oracle.com \
--to=daniel.m.jordan@oracle.com \
--cc=aik@ozlabs.ru \
--cc=akpm@linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=atull@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=cl@linux.com \
--cc=dave@stgolabs.net \
--cc=hao.wu@intel.com \
--cc=jgg@mellanox.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mark.rutland@arm.com \
--cc=mdf@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@ozlabs.org \
--cc=steven.sistare@oracle.com \
/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;
as well as URLs for NNTP newsgroup(s).