Thread (14 messages) 14 messages, 6 authors, 2019-06-03

Re: [PATCH v2] mm: add account_locked_vm utility function

From: Daniel Jordan <daniel.m.jordan@oracle.com>
Date: 2019-05-29 18:39:08
Also in: kvm, linux-fpga, linux-mm, lkml

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:
quoted
+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...
quoted
+/**
+ * __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...
quoted
+
+	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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help