Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7490236ybp; Wed, 16 Oct 2019 09:24:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqysjJp3a82wkXCvTOjF9Go4sQQPTXY46pxHcMGaezGlyBnF3MvRBflSTUC9CUoYUqmCLnfh X-Received: by 2002:a17:906:5381:: with SMTP id g1mr40450903ejo.159.1571243053203; Wed, 16 Oct 2019 09:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571243053; cv=none; d=google.com; s=arc-20160816; b=J/5xNl7JiC4/OO4wRC9XGYE5BL+EgRUzOZoGMc0tG+4Fp+5UjldRDyzTBifB98/r+K CYnwMZ/zkRBk5GF4jHE3fAsxMxqJD7414q0pV81yxLD4WXseZhMIPl4Uu6JpaWUfkblT DiFKxsyLmk/aJtCbd4Es50E145yEcbK6mElbGoCwW2DNdHwM+cTxAmCzc1C9fydLXzua STCAAHzC7zZu/mbudL2f9QgN37BHoyiPDj49hswZD/LZ1Tu0NJq2aLehJ+fMULoZx83T uop7QUMUx7B+KybmA0szysBj1GuNKiB/eL3v+EDxIAzMDhcp6kR141VnMEBBU0nvDdtV 3hXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization; bh=HVFRmj3IA2Y/VFsBMvpmRIaw8/U1L1jV8azSeDNL3+o=; b=ZhmGmM0hMJ6CRUpG2fmSDl7+aSQAGQKhSFkSOkvas8VTiAuifbhwxDWvDwakIvyyrs jl21CFIGaTbmf9LRq1Lzp48M0Np2zzaNpXvfsbY7f3Jw4xkZWRQdW7mQdO27nwX1ne5i xzDjW/Tve7TdUmo9Zl5LjPdua3UrYxF+NHIpgDnGBAyGu089sNvCSh/NvME5UqBcmkgh b2nSmJWNLF4FgYAQGMwrJpc1kXS9O60wtxozuY4YLhRsXc4PRgyPYLO4jXeokDpPw92d NHGr9JxosY+pY9THj45aQ+8g2FT/RjFY8hGzR+tljXsMc+HoSGQb70GWlNWFX7/imLtB ElMg== 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 f57si16738301ede.78.2019.10.16.09.23.48; Wed, 16 Oct 2019 09:24:13 -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 S2394035AbfJPO0a convert rfc822-to-8bit (ORCPT + 99 others); Wed, 16 Oct 2019 10:26:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40738 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387995AbfJPO0a (ORCPT ); Wed, 16 Oct 2019 10:26:30 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 830493086E27; Wed, 16 Oct 2019 14:26:29 +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 35D195D9DC; Wed, 16 Oct 2019 14:26:26 +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 From: David Howells In-Reply-To: References: <157117606853.15019.15459271147790470307.stgit@warthog.procyon.org.uk> <157117608708.15019.1998141309054662114.stgit@warthog.procyon.org.uk> To: Linus Torvalds Cc: dhowells@redhat.com, Tim Chen , Kan Liang , Casey Schaufler , Stephen Smalley , Greg Kroah-Hartman , Nicolas Dichtel , raven@themaw.net, Christian Brauner , keyrings@vger.kernel.org, linux-usb@vger.kernel.org, linux-block , LSM List , linux-fsdevel , Linux API , Linux Kernel Mailing List Subject: Re: [RFC PATCH 02/21] Add a prelocked wake-up MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6899.1571235985.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Wed, 16 Oct 2019 15:26:25 +0100 Message-ID: <6900.1571235985@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 16 Oct 2019 14:26:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Btw, is there any point in __wake_up_sync_key() taking a nr_exclusive argument since it clears WF_SYNC if nr_exclusive != 1 and doesn't make sense to be >1 anyway. David --- diff --git a/include/linux/wait.h b/include/linux/wait.h index 3eb7cae8206c..bb7676d396cd 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -201,9 +201,9 @@ void __wake_up(struct wait_queue_head *wq_head, unsigned int mode, int nr, void void __wake_up_locked_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); void __wake_up_locked_key_bookmark(struct wait_queue_head *wq_head, unsigned int mode, void *key, wait_queue_entry_t *bookmark); -void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode, int nr, void *key); +void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); void __wake_up_locked(struct wait_queue_head *wq_head, unsigned int mode, int nr); -void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr); +void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode); #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) @@ -214,7 +214,7 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr); #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) #define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) -#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) +#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE) /* * Wakeup macros to be used to report events to the targets. @@ -228,7 +228,7 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr); #define wake_up_interruptible_poll(x, m) \ __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)) + __wake_up_sync_key((x), TASK_INTERRUPTIBLE, poll_to_key(m)) #define ___wait_cond_timeout(condition) \ ({ \ diff --git a/kernel/exit.c b/kernel/exit.c index a46a50d67002..a1ff25ef050e 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1435,7 +1435,7 @@ static int child_wait_callback(wait_queue_entry_t *wait, unsigned mode, void __wake_up_parent(struct task_struct *p, struct task_struct *parent) { __wake_up_sync_key(&parent->signal->wait_chldexit, - TASK_INTERRUPTIBLE, 1, p); + TASK_INTERRUPTIBLE, p); } static long do_wait(struct wait_opts *wo) diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index c1e566a114ca..b4b52361dab7 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c @@ -169,7 +169,6 @@ EXPORT_SYMBOL_GPL(__wake_up_locked_key_bookmark); * __wake_up_sync_key - wake up threads blocked on a waitqueue. * @wq_head: the waitqueue * @mode: which threads - * @nr_exclusive: how many wake-one or wake-many threads to wake up * @key: opaque value to be passed to wakeup targets * * The sync wakeup differs that the waker knows that it will schedule @@ -183,26 +182,21 @@ EXPORT_SYMBOL_GPL(__wake_up_locked_key_bookmark); * accessing the task state. */ void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode, - int nr_exclusive, void *key) + void *key) { - int wake_flags = 1; /* XXX WF_SYNC */ - if (unlikely(!wq_head)) return; - if (unlikely(nr_exclusive != 1)) - wake_flags = 0; - - __wake_up_common_lock(wq_head, mode, nr_exclusive, wake_flags, key); + __wake_up_common_lock(wq_head, mode, 1, WF_SYNC, key); } EXPORT_SYMBOL_GPL(__wake_up_sync_key); /* * __wake_up_sync - see __wake_up_sync_key() */ -void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr_exclusive) +void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode) { - __wake_up_sync_key(wq_head, mode, nr_exclusive, NULL); + __wake_up_sync_key(wq_head, mode, NULL); } EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */