From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752434AbdB1N2j (ORCPT ); Tue, 28 Feb 2017 08:28:39 -0500 Received: from LGEAMRELO12.lge.com ([156.147.23.52]:35948 "EHLO lgeamrelo12.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677AbdB1N2i (ORCPT ); Tue, 28 Feb 2017 08:28:38 -0500 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 165.244.249.25 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com Date: Tue, 28 Feb 2017 22:28:20 +0900 From: Byungchul Park To: Peter Zijlstra CC: , , , , , , , , , , Subject: Re: [PATCH v5 06/13] lockdep: Implement crossrelease feature Message-ID: <20170228132820.GH3817@X58A-UD3R> References: <1484745459-2055-1-git-send-email-byungchul.park@lge.com> <1484745459-2055-7-git-send-email-byungchul.park@lge.com> <20170228130513.GH5680@worktop> MIME-Version: 1.0 In-Reply-To: <20170228130513.GH5680@worktop> User-Agent: Mutt/1.5.21 (2010-09-15) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB06/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2017/02/28 22:28:34, Serialize by Router on LGEKRMHUB06/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2017/02/28 22:28:34, Serialize complete at 2017/02/28 22:28:34 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 28, 2017 at 02:05:13PM +0100, Peter Zijlstra wrote: > 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. Really? When is a better time to do it? I think the time creating a task is the best time to initialize it. No? > > > + 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. Yes. It looks much better. Thank you very much. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id 9DA296B03AF for ; Tue, 28 Feb 2017 08:28:37 -0500 (EST) Received: by mail-pf0-f198.google.com with SMTP id h72so14617164pfd.5 for ; Tue, 28 Feb 2017 05:28:37 -0800 (PST) Received: from lgeamrelo12.lge.com (LGEAMRELO12.lge.com. [156.147.23.52]) by mx.google.com with ESMTP id g12si1808395pla.21.2017.02.28.05.28.36 for ; Tue, 28 Feb 2017 05:28:36 -0800 (PST) Date: Tue, 28 Feb 2017 22:28:20 +0900 From: Byungchul Park Subject: Re: [PATCH v5 06/13] lockdep: Implement crossrelease feature Message-ID: <20170228132820.GH3817@X58A-UD3R> References: <1484745459-2055-1-git-send-email-byungchul.park@lge.com> <1484745459-2055-7-git-send-email-byungchul.park@lge.com> <20170228130513.GH5680@worktop> MIME-Version: 1.0 In-Reply-To: <20170228130513.GH5680@worktop> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Sender: owner-linux-mm@kvack.org List-ID: To: Peter Zijlstra Cc: mingo@kernel.org, tglx@linutronix.de, walken@google.com, boqun.feng@gmail.com, kirill@shutemov.name, linux-kernel@vger.kernel.org, linux-mm@kvack.org, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, npiggin@gmail.com, kernel-team@lge.com On Tue, Feb 28, 2017 at 02:05:13PM +0100, Peter Zijlstra wrote: > 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. Really? When is a better time to do it? I think the time creating a task is the best time to initialize it. No? > > > + 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. Yes. It looks much better. Thank you very much. -- 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: email@kvack.org