Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp6903685ybp; Wed, 16 Oct 2019 00:20:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVbdlCgsxAMru2p6G2P0QkwOfRjMabnS8t3fdaojy9tVv+D8shs7fYUiUVIlHOeA6sjLws X-Received: by 2002:aa7:de02:: with SMTP id h2mr37658060edv.212.1571210432767; Wed, 16 Oct 2019 00:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571210432; cv=none; d=google.com; s=arc-20160816; b=ZeQs8vwI2NY3Rr8Tlqc4yw4MCp/Q+V3xds1xBGunturgmzpsel0qhsXHtrNeH0XfAj lv2bMHgpQtEwnODMBRqRS64USHg15TDvSbumiHugdiwiE+ReqA8C4rUGB4Ks4Isrj8vE SZqjeO9jiXc2Vu8q3G5NYybxS/lcRyC4TgWOdxY+pg0C5zLDsMal67DjsjD7F9r7koCP 140Q3vy+UG+EYQVfnIbQ4ksOJvJnOvEkXr03eW6YzJ2Hkg7GlrtPTAj1Xvmk9HPL0a7J mq0be8zNkhjTj7JiPvW32b0DszPSGqS7SblHft71znf78E0DhpKLd4fjIpzFPJwqYi+P TMQQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization; bh=BkEqCJzXmatBFCA1AJXYHFW6zX7NZK1j5qceaFGQvmM=; b=kZ4HP6SZxgujRjwoPu2X9LY97ZP6Z3zGPde1iJYH5F6EBxLIGJ23ZaKPLYNi01Q97j GMDz9biGrvh12O6KjbcCFvDDVqHeYAVbwc87c9UlgPDGSj2EliXWQUIs4a4ZEdrjk4iC nwvzvhtUy4u39Pu5tK8TDGnRNic0PcdmxnDthSuaF7n+2hopSZr11GQ88H6ZRoqdAOPd Nz2lJ44ws7QFfVcGHhsFz13XJIzP8TadoJikx5SOyuY7Vn5aALZCDuXq60kNju8z8QCe lxOLOa7IfYkD+l0+UuujjlzghRnzvQ2cJeyM/K/JSGs+N3c7q9bhabVDUnPx/c6vsRn5 9Q2w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 l18si14375896ejg.248.2019.10.16.00.20.09; Wed, 16 Oct 2019 00:20:32 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731171AbfJOVsN (ORCPT + 99 others); Tue, 15 Oct 2019 17:48:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49798 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730483AbfJOVsK (ORCPT ); Tue, 15 Oct 2019 17:48:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C1A073A62; Tue, 15 Oct 2019 21:48:10 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-121-84.rdu2.redhat.com [10.10.121.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1D6360852; Tue, 15 Oct 2019 21:48:07 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [RFC PATCH 02/21] Add a prelocked wake-up From: David Howells To: torvalds@linux-foundation.org Cc: dhowells@redhat.com, Casey Schaufler , Stephen Smalley , Greg Kroah-Hartman , nicolas.dichtel@6wind.com, raven@themaw.net, Christian Brauner , dhowells@redhat.com, keyrings@vger.kernel.org, linux-usb@vger.kernel.org, linux-block@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 15 Oct 2019 22:48:07 +0100 Message-ID: <157117608708.15019.1998141309054662114.stgit@warthog.procyon.org.uk> In-Reply-To: <157117606853.15019.15459271147790470307.stgit@warthog.procyon.org.uk> References: <157117606853.15019.15459271147790470307.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 15 Oct 2019 21:48:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a wakeup call for a case whereby the caller already has the waitqueue spinlock held. This can be used by pipes to alter the ring buffer indices under the spinlock. Signed-off-by: David Howells --- include/linux/wait.h | 2 ++ kernel/sched/wait.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/linux/wait.h b/include/linux/wait.h index 3eb7cae8206c..d511b298a20c 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -229,6 +229,8 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr); __wake_up(x, TASK_INTERRUPTIBLE, 1, poll_to_key(m)) #define wake_up_interruptible_sync_poll(x, m) \ __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, poll_to_key(m)) +void prelocked_wake_up_interruptible_sync_poll(struct wait_queue_head *wq_head, + __poll_t mask); #define ___wait_cond_timeout(condition) \ ({ \ diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index c1e566a114ca..43fbbbe9af27 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c @@ -126,6 +126,13 @@ static void __wake_up_common_lock(struct wait_queue_head *wq_head, unsigned int } while (bookmark.flags & WQ_FLAG_BOOKMARK); } +void prelocked_wake_up_interruptible_sync_poll(struct wait_queue_head *wq_head, + __poll_t mask) +{ + __wake_up_common(wq_head, TASK_INTERRUPTIBLE, 1, WF_SYNC, + poll_to_key(mask), NULL); +} + /** * __wake_up - wake up threads blocked on a waitqueue. * @wq_head: the waitqueue