[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190529183559.jzkpvbdiimnp3n2m@ca-dmjordan1.us.oracle.com>
Date: Wed, 29 May 2019 14:35:59 -0400
From: Daniel Jordan <daniel.m.jordan@...cle.com>
To: Ira Weiny <ira.weiny@...el.com>
Cc: Daniel Jordan <daniel.m.jordan@...cle.com>,
akpm@...ux-foundation.org, Alexey Kardashevskiy <aik@...abs.ru>,
Alan Tull <atull@...nel.org>,
Alex Williamson <alex.williamson@...hat.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Christoph Lameter <cl@...ux.com>,
Christophe Leroy <christophe.leroy@....fr>,
Davidlohr Bueso <dave@...olabs.net>,
Jason Gunthorpe <jgg@...lanox.com>,
Mark Rutland <mark.rutland@....com>,
Michael Ellerman <mpe@...erman.id.au>,
Moritz Fischer <mdf@...nel.org>,
Paul Mackerras <paulus@...abs.org>,
Steve Sistare <steven.sistare@...cle.com>,
Wu Hao <hao.wu@...el.com>, linux-mm@...ck.org,
kvm@...r.kernel.org, kvm-ppc@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-fpga@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm: add account_locked_vm utility function
On Wed, May 29, 2019 at 11:05:48AM -0700, Ira Weiny wrote:
> On Fri, May 24, 2019 at 01:50:45PM -0400, Daniel Jordan wrote:
> > +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;
> > +}
> > +
...snip...
> > +/**
> > + * __account_locked_vm - account locked pages to an mm's locked_vm
> > + * @mm: mm to account against, may be NULL
>
> This kernel doc is wrong. You dereference mm straight away...
...snip...
> > +
> > + locked_vm = mm->locked_vm;
>
> here...
>
> Perhaps the comment was meant to document account_locked_vm()?
Yes, the comment got out of sync when I moved the !mm check outside
__account_locked_vm. Thanks for catching, will fix.
Powered by blists - more mailing lists