Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4549587ybi; Tue, 30 Jul 2019 04:04:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLadz14HAdtJWvuIvjiQ+hTfpD73siw9rCU1xUiTPuY9KjHD5OOu+LMuaAHzgr6lQjAZyk X-Received: by 2002:a65:5183:: with SMTP id h3mr1828010pgq.250.1564484680930; Tue, 30 Jul 2019 04:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564484680; cv=none; d=google.com; s=arc-20160816; b=ZqYzDeP+B2b9UAFgy2D6O3pW3pN6Df22Wi1ApVIMBZijmbw7xI9RmGq+U7i1Q3rpBt wYR+jYkeJd9L/dRyzNF9LMT5FFOEHpCXIbht//UIYB2NXdC5r6gTU4HQroCBZ1NnoDyN +9OZ44xPC+fP4c6mZQRdRa3A4sDuHzQYl4e0oFNaFZI8LUA59Oep3ycoED0h0urw3Jqi lmMp8o8IPA+RyvhKvkVJhkqToRjzsMKJ7Lx3FkKtCa2KWHWAHkOJu4wsitb0F0gN/QRV GkmmGg9Ywse30iR5gKri48ggCVwEwqLU1qMhYES+nnK3BhT8HlGgLvMsC3Q68zTlapT3 vNdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3nu47du/8iubKjsIzjPixD1xaKj4CUcoohnp51Rw7eo=; b=ms5WnCWGeoKhWh40IzsxFeEb1cTGkdeT4pEbkCN8x136hg1a+S7Dq1LG9Rj1DBSZzs 7RDH3t0q87rmMAWg7nrdkT60OkJjtpg5UG/HxQrQS32fn7NooTITY0K3cx6iCyRPg8jc sKoZxoua8YvVCtefl3Qj869qvGqV7lQ98O1imi+A25YyOSkTafHTFPxh/AbxA+3WPMmI iVAXljfrBY1BctGddGOX0QnZF2+RYimXzOr11ijmYIJA07HtiT4WiXSESI/PtCYK8rmd We4WFLerUDT4yA5/JWdw58aFJxCskH6AMxHF4kDmMgJ4aKllierk3pcPyHQ4hPZpvjax W2jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=KW3f3qzO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si33012320pgb.206.2019.07.30.04.04.26; Tue, 30 Jul 2019 04:04:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=KW3f3qzO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730790AbfG3IDQ (ORCPT + 99 others); Tue, 30 Jul 2019 04:03:16 -0400 Received: from merlin.infradead.org ([205.233.59.134]:55860 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729810AbfG3IDQ (ORCPT ); Tue, 30 Jul 2019 04:03:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3nu47du/8iubKjsIzjPixD1xaKj4CUcoohnp51Rw7eo=; b=KW3f3qzODooeqs96VV2Xkhow0 urjs6/igcasbivaBcvLfZuidGFRP38/htqosHaeLpv2a1cWtnbF3DZJr1lPgylo/qxHjCzT+eXJ19 nZHIz3T5C0H1MrKJD2X9+3xnlmBooBzdRUiPYSKP8cr6ZC4RqVj1QwQR7wsmF23MCazqKj9WOpDY8 A5AdgqO4WtvujNn7U/HUneoJQtZPRbS0RPOGEfnwT4ZwO5m0Gz90td5yK08kf2beAuCKoArQraMqs NnWjjavGMxAVVAIaf4ylR5Wib+A28PIs8al6uG8ExUM14Glrsh/NHM20M29FohIePceBR0w1pphiG DdZta8BOA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hsN6F-0005GN-Jw; Tue, 30 Jul 2019 08:03:13 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ADB1820AFFE9F; Tue, 30 Jul 2019 10:03:08 +0200 (CEST) Date: Tue, 30 Jul 2019 10:03:08 +0200 From: Peter Zijlstra To: Mukesh Ojha Cc: mingo@redhat.com, will@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] locking/mutex: Use mutex flags macro instead of hard code value Message-ID: <20190730080308.GF31381@hirez.programming.kicks-ass.net> References: <1564397578-28423-1-git-send-email-mojha@codeaurora.org> <1564397578-28423-2-git-send-email-mojha@codeaurora.org> <20190729110727.GB31398@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 30, 2019 at 01:23:13PM +0530, Mukesh Ojha wrote: > > On 7/29/2019 4:37 PM, Peter Zijlstra wrote: > > On Mon, Jul 29, 2019 at 04:22:58PM +0530, Mukesh Ojha wrote: > > > Let's use the mutex flag macro(which got moved from mutex.c > > > to linux/mutex.h in the last patch) instead of hard code > > > value which was used in __mutex_owner(). > > > > > > Signed-off-by: Mukesh Ojha > > > --- > > > include/linux/mutex.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/include/linux/mutex.h b/include/linux/mutex.h > > > index 79b28be..c3833ba 100644 > > > --- a/include/linux/mutex.h > > > +++ b/include/linux/mutex.h > > > @@ -87,7 +87,7 @@ struct mutex { > > > */ > > > static inline struct task_struct *__mutex_owner(struct mutex *lock) > > > { > > > - return (struct task_struct *)(atomic_long_read(&lock->owner) & ~0x07); > > > + return (struct task_struct *)(atomic_long_read(&lock->owner) & ~MUTEX_FLAGS); > > > } > > I would _much_ rather move __mutex_owner() out of line, you're exposing > > far too much stuff. > > if i understand you correctly, you want me to move __mutex_owner() to > mutex.c > __mutex_owner() is used in mutex_is_locked() and mutex_trylock_recursive > inside linux/mutex.h. > > Shall i move them as well ? Yes, then you can make __mutex_owner() static. Thanks!