Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3353062ybc; Mon, 18 Nov 2019 13:54:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwatmhLBrp2Et+w6CN07J6CHo7K1RHPMQDYeVS3/ti1QTWi2qh0Ch/fgMUxb9L6wCK/MG7f X-Received: by 2002:a17:906:3ec2:: with SMTP id d2mr30331689ejj.251.1574114085997; Mon, 18 Nov 2019 13:54:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574114085; cv=none; d=google.com; s=arc-20160816; b=suYibnyNE4DOOEumLObIsKQp/FRWbR+MQIoJzxFBdShldQ6JlZcsozTIlaIwskfUjy l+LgOYbJEMSJE96usvR1gvv6FZTeN19TZhzDPfUoxo93WR7PmxEon6mVzXthpHue1ayt CLgyzilXn7Jx425x/wE9oiiFzB0MRW6Ti03ukEr5mY+xIcXEuyIyjTBmkS1dVNYogfGq 2wLbo7CXzrbulGs3nPOC8fLhcHMzbIs4Gm7+A6Pd0XO7aRxQ57pM1GWBNJWPHSQntn7A iHt5iDuCSN+A40n8HfAu3ecpgcJQX3i/PJ7xv672xXjSzQkS2OtBp+FWUjzCtcWsmZlM oShQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=37fM1KMKYNrGbiZSg07VSdDytySB2r4xXsbLO3HzSdo=; b=O4wo/eeXlrSjqqlY9Jm+Fe/mvAJArv7n+r44MKF/eJRRbYn+RtlkQO/iwkQLsjHUBj q/qefz9VljdzKwtuyQM8f5CKFcnORT/6zkZ9z1pZ/knCLVBaLNa6ZLzJxom0i5M1p9I2 0D0ZryHkIhDV1dKwWQKb+004GZVnucsyHzHqByuCI+oEohxbFUOFFRnmPIFaTnTqHCgF HD27j2ZVdatBfx23NfexVpywIY/hMC0Z5I4FMjgT/mKzvGZNqIekHnBaIniB2BG1wu1w wui/fb94YLSsexPtU+S5r6DWBARu13tRXRk5sVhSpYFf0+b8slgcEMTnONi5BhQtZpIB OFnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J0lCJRdg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si14345733eda.115.2019.11.18.13.54.22; Mon, 18 Nov 2019 13:54:45 -0800 (PST) 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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J0lCJRdg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726939AbfKRVwi (ORCPT + 99 others); Mon, 18 Nov 2019 16:52:38 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28590 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726647AbfKRVwh (ORCPT ); Mon, 18 Nov 2019 16:52:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574113956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=37fM1KMKYNrGbiZSg07VSdDytySB2r4xXsbLO3HzSdo=; b=J0lCJRdgC8PhMrgAyDwWRmhXrFgWVpNYHxg2Q4g+XiFyf9bWBGg18b4Ofx3In0uCLckhoR DWuCUZj9Tobh0q3rgGVqQauk+qgQcVgmza7nvHnnF2i4PaZ3SUloFhCDdOk8LtfzsWSyDR h/7uY5Yjdu0vFBsVbi2GWKyYnIJ9y0M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-286-fJFIxhqENmWVImvxdMKnew-1; Mon, 18 Nov 2019 16:52:35 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 02C4C477; Mon, 18 Nov 2019 21:52:34 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-59.bos.redhat.com [10.18.17.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 669B25DD98; Mon, 18 Nov 2019 21:52:24 +0000 (UTC) Subject: Re: [PATCH 5/5] locking/percpu-rwsem: Remove the embedded rwsem To: Peter Zijlstra , mingo@kernel.org, will@kernel.org Cc: oleg@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, bigeasy@linutronix.de, juri.lelli@redhat.com, williams@redhat.com, bristot@redhat.com, dave@stgolabs.net, jack@suse.com References: <20191113102115.116470462@infradead.org> <20191113102855.925208237@infradead.org> From: Waiman Long Organization: Red Hat Message-ID: <7b412d15-b796-3b8d-0e98-22362377093f@redhat.com> Date: Mon, 18 Nov 2019 16:52:23 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20191113102855.925208237@infradead.org> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: fJFIxhqENmWVImvxdMKnew-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/13/19 5:21 AM, Peter Zijlstra wrote: > @@ -130,20 +131,12 @@ static inline void percpu_rwsem_release( > =09=09=09=09=09bool read, unsigned long ip) > { > =09lock_release(&sem->dep_map, ip); > -#ifdef CONFIG_RWSEM_SPIN_ON_OWNER > -=09if (!read) > -=09=09atomic_long_set(&sem->rw_sem.owner, RWSEM_OWNER_UNKNOWN); > -#endif > } > =20 This is the only place that set RWSEM_OWNER_UNKNOWN. So you may as well remove all references to it: diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 00d6054687dd..8a418d9eeb7a 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h @@ -53,12 +53,6 @@ struct rw_semaphore { =C2=A0#endif =C2=A0}; =C2=A0 -/* - * Setting all bits of the owner field except bit 0 will indicate - * that the rwsem is writer-owned with an unknown owner. - */ -#define RWSEM_OWNER_UNKNOWN=C2=A0=C2=A0=C2=A0 (-2L) - =C2=A0/* In all implementations count !=3D 0 means locked */ =C2=A0static inline int rwsem_is_locked(struct rw_semaphore *sem) =C2=A0{ diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index eef04551eae7..622842754c73 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -660,8 +660,6 @@ static inline bool rwsem_can_spin_on_owner(struct rw_semapho =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unsigned long flags; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bool ret =3D true; =C2=A0 -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 BUILD_BUG_ON(!(RWSEM_OWNER_UNKNOWN & = RWSEM_NONSPINNABLE)); - =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (need_resched()) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 lockevent_inc(rwsem_opt_fail); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 return false; Cheers, Longman