Thread (62 messages) 62 messages, 4 authors, 2017-03-14

Re: [PATCH v5 06/13] lockdep: Implement crossrelease feature

From: Peter Zijlstra <peterz@infradead.org>
Date: 2017-02-28 13:11:40
Also in: lkml

On Wed, Jan 18, 2017 at 10:17:32PM +0900, Byungchul Park wrote:
+#define MAX_XHLOCKS_NR 64UL
+#ifdef CONFIG_LOCKDEP_CROSSRELEASE
+	if (tsk->xhlocks) {
+		void *tmp = tsk->xhlocks;
+		/* Disable crossrelease for current */
+		tsk->xhlocks = NULL;
+		vfree(tmp);
+	}
+#endif
+#ifdef CONFIG_LOCKDEP_CROSSRELEASE
+	p->xhlock_idx = 0;
+	p->xhlock_idx_soft = 0;
+	p->xhlock_idx_hard = 0;
+	p->xhlock_idx_nmi = 0;
+	p->xhlocks = vzalloc(sizeof(struct hist_lock) * MAX_XHLOCKS_NR);
I don't think we need vmalloc for this now.
+	p->work_id = 0;
+#endif
+#ifdef CONFIG_LOCKDEP_CROSSRELEASE
+	if (p->xhlocks) {
+		void *tmp = p->xhlocks;
+		/* Diable crossrelease for current */
+		p->xhlocks = NULL;
+		vfree(tmp);
+	}
+#endif
Second instance of the same code, which would suggest using a function
for this. Also, with a function you can loose the #ifdeffery.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help