Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1764137pxt; Sun, 8 Aug 2021 00:27:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzp4E17XeYfaAl1mpJYwKNo5EwgTqOoYr0ue+clsBMRnh2LIHbI/NQhIi6kY5WR6k6CSzXK X-Received: by 2002:a17:907:72ce:: with SMTP id du14mr17562238ejc.523.1628407631562; Sun, 08 Aug 2021 00:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628407631; cv=none; d=google.com; s=arc-20160816; b=GUVcTp1gG6NYQ/FpK8sdx7VdZQJm39cBjT5yKMzFuQLiK1+eAxIjS+HlV9GRT7jMaY 1GUnFEoBYX0DsQDO0srYu5tzcB6zxEggiZKXFcZ3NRoqc4BQ6+td5m4vKxuK1iEhzv9n X/gsRVyd9kzanZQVtsARVem3zXq4L8WtSNmuVugjKFv643UwH4+Xh/zCD9D1aH5eDJfM YepQF/BbjtVbUTgN4splQ5HW11kq3EwKUEfk0UXRRX4MbrA7Jkak3s+/inZ2phgMm22r A1MEHH8ldKbbsw/bYlY/Wayo8NP8eMiYW/7ghp9VDwGV/yJnnGaj9QeL0KFpmxgNbr36 lXRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DD80IHMaQocOcqHdacbg8KFyV66Js7u8G1xY7otxDuM=; b=xnmySLwfiG3zXOdQC3FrHjWxWr/emzV8sju2lCh6Wcl4qpbWfN6LU6xvX6OavTmI5N Rl57BXk+pPRNCRkqtX0F2wUKkrpaqNCrX7bX+kDSDB5q9juB5Wg+o7Yy/DZRgZGaFrE6 e8bMPXC2vu/SJxAZCS49gtViwLDp/CvXTboTZQsI36kiDEJ9OyldeFE7JWteVQw83o+P UFDcCiAUOvsrsfVIvPJ+FB8m1fQy4vWLMLPWdFYGq4QQ2cRbPS0i9fYotIwtXxps80sb TTW3zWKSHbvW/S9vDtCurtF2eTmtyIRyp0SmFqG92c85qqGs8PUgRUr+iHId4F0MzTrP 170A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yf2xBVVQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o15si13025952edc.22.2021.08.08.00.26.48; Sun, 08 Aug 2021 00:27:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yf2xBVVQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231356AbhHHHX2 (ORCPT + 99 others); Sun, 8 Aug 2021 03:23:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:55066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231284AbhHHHXX (ORCPT ); Sun, 8 Aug 2021 03:23:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3478560EE7; Sun, 8 Aug 2021 07:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628407384; bh=1laAJwA0m3w1XOFNWusedhcgUBIn/Ok8fTYwSEJXPtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yf2xBVVQXh07u4aLjUu4ixgYiObekv9RBNWcWH6HtnHmfAssg/zdJaiAj0A7v/6Gr Q4BhhNz0uPFa2k+F13kXvH0SEG7cDQaOQIOOIIzN585B9tOvRh1EafVHkyl4YjpH7a IwVwlB80nT36LyiXtRdk1RNaegsDjfY+UIls9ZLo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , juri.lelli@arm.com, bigeasy@linutronix.de, xlpang@redhat.com, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jdesfossez@efficios.com, dvhart@infradead.org, bristot@redhat.com, Thomas Gleixner , Zhen Lei , Joe Korty Subject: [PATCH 4.4 03/11] futex,rt_mutex: Introduce rt_mutex_init_waiter() Date: Sun, 8 Aug 2021 09:22:38 +0200 Message-Id: <20210808072217.435137340@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210808072217.322468704@linuxfoundation.org> References: <20210808072217.322468704@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra [ Upstream commit 50809358dd7199aa7ce232f6877dd09ec30ef374 ] Since there's already two copies of this code, introduce a helper now before adding a third one. Signed-off-by: Peter Zijlstra (Intel) Cc: juri.lelli@arm.com Cc: bigeasy@linutronix.de Cc: xlpang@redhat.com Cc: rostedt@goodmis.org Cc: mathieu.desnoyers@efficios.com Cc: jdesfossez@efficios.com Cc: dvhart@infradead.org Cc: bristot@redhat.com Link: http://lkml.kernel.org/r/20170322104151.950039479@infradead.org Signed-off-by: Thomas Gleixner Signed-off-by: Zhen Lei Acked-by: Joe Korty Signed-off-by: Greg Kroah-Hartman --- kernel/futex.c | 5 +---- kernel/locking/rtmutex.c | 12 +++++++++--- kernel/locking/rtmutex_common.h | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3156,10 +3156,7 @@ static int futex_wait_requeue_pi(u32 __u * The waiter is allocated on our stack, manipulated by the requeue * code while we sleep on uaddr. */ - debug_rt_mutex_init_waiter(&rt_waiter); - RB_CLEAR_NODE(&rt_waiter.pi_tree_entry); - RB_CLEAR_NODE(&rt_waiter.tree_entry); - rt_waiter.task = NULL; + rt_mutex_init_waiter(&rt_waiter); ret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2, VERIFY_WRITE); if (unlikely(ret != 0)) --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -1155,6 +1155,14 @@ void rt_mutex_adjust_pi(struct task_stru next_lock, NULL, task); } +void rt_mutex_init_waiter(struct rt_mutex_waiter *waiter) +{ + debug_rt_mutex_init_waiter(waiter); + RB_CLEAR_NODE(&waiter->pi_tree_entry); + RB_CLEAR_NODE(&waiter->tree_entry); + waiter->task = NULL; +} + /** * __rt_mutex_slowlock() - Perform the wait-wake-try-to-take loop * @lock: the rt_mutex to take @@ -1236,9 +1244,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, struct rt_mutex_waiter waiter; int ret = 0; - debug_rt_mutex_init_waiter(&waiter); - RB_CLEAR_NODE(&waiter.pi_tree_entry); - RB_CLEAR_NODE(&waiter.tree_entry); + rt_mutex_init_waiter(&waiter); raw_spin_lock(&lock->wait_lock); --- a/kernel/locking/rtmutex_common.h +++ b/kernel/locking/rtmutex_common.h @@ -102,6 +102,7 @@ extern struct task_struct *rt_mutex_next extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, struct task_struct *proxy_owner); extern void rt_mutex_proxy_unlock(struct rt_mutex *lock); +extern void rt_mutex_init_waiter(struct rt_mutex_waiter *waiter); extern int rt_mutex_start_proxy_lock(struct rt_mutex *lock, struct rt_mutex_waiter *waiter, struct task_struct *task);