From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-4.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 034A91F8C6 for ; Wed, 18 Aug 2021 08:23:08 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BCD013889429 for ; Wed, 18 Aug 2021 08:23:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCD013889429 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629274986; bh=eIKylyUWkupQ9je6VYA0DlcPMd0VOEOkiwD0SYFuUcA=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=MhpD7NnS7JcNAxClgFMEAGF3XTSYQOtKRRIajPvziGnSSk1izyBPRmqpghZ/sIwr0 xTyIvFwIE1X9RnfhZN+J34SES9f0SFD0qJM8kQMp6Mn7jegXkF3xiInKrc6kcfR1Hs TLxxdHvS01sPfGkzWmYULnQXVEdW/t066XKKeYYg= Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by sourceware.org (Postfix) with ESMTPS id E804F3889815 for ; Wed, 18 Aug 2021 08:22:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E804F3889815 To: =?utf-8?Q?Andr=C3=A9?= Almeida , Ingo Molnar , Peter Zijlstra , Darren Hart , linux-kernel@vger.kernel.org, Steven Rostedt , Sebastian Andrzej Siewior Subject: Re: [PATCH 1/4] futex: Prepare for futex_wait_multiple() In-Reply-To: <20210805190405.59110-2-andrealmeid@collabora.com> References: <20210805190405.59110-1-andrealmeid@collabora.com> <20210805190405.59110-2-andrealmeid@collabora.com> Date: Wed, 18 Aug 2021 10:22:28 +0200 Message-ID: <8735r72md7.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Thomas Gleixner via Libc-alpha Reply-To: Thomas Gleixner Cc: Davidlohr Bueso , libc-alpha@sourceware.org, linux-api@vger.kernel.org, mtk.manpages@gmail.com, =?utf-8?Q?Andr=C3=A9?= Almeida , kernel@collabora.com, krisman@collabora.com Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" Andre, On Thu, Aug 05 2021 at 16:04, Andr=C3=A9 Almeida wrote: > +/* > + * Futex flags used to encode options to functions and preserve them acr= oss > + * restarts. > + */ > +#ifdef CONFIG_MMU > +# define FLAGS_SHARED 0x01 > +#else > +/* > + * NOMMU does not have per process address space. Let the compiler optim= ize > + * code away. > + */ > +# define FLAGS_SHARED 0x00 > +#endif > +#define FLAGS_CLOCKRT 0x02 > +#define FLAGS_HAS_TIMEOUT 0x04 > + > /* > * Futexes are matched on equal values of this key. > * The key type depends on whether it's a shared or private mapping. > @@ -50,8 +66,52 @@ union futex_key { > } both; > }; >=20=20 > +/** > + * struct futex_q - The hashed futex queue entry, one per waiting task > + * @list: priority-sorted list of tasks waiting on this futex > + * @task: the task waiting on the futex > + * @lock_ptr: the hash bucket lock > + * @key: the key the futex is hashed on > + * @pi_state: optional priority inheritance state > + * @rt_waiter: rt_waiter storage for use with requeue_pi > + * @requeue_pi_key: the requeue_pi target futex key > + * @bitset: bitset for the optional bitmasked wakeup > + * > + * We use this hashed waitqueue, instead of a normal wait_queue_entry_t,= so > + * we can wake only the relevant ones (hashed queues may be shared). > + * > + * A futex_q has a woken state, just like tasks have TASK_RUNNING. > + * It is considered woken when plist_node_empty(&q->list) || q->lock_ptr= =3D=3D 0. > + * The order of wakeup is always to make the first condition true, then > + * the second. > + * > + * PI futexes are typically woken before they are removed from the hash = list via > + * the rt_mutex code. See unqueue_me_pi(). > + */ > +struct futex_q { > + struct plist_node list; > + > + struct task_struct *task; > + spinlock_t *lock_ptr; > + union futex_key key; > + struct futex_pi_state *pi_state; > + struct rt_mutex_waiter *rt_waiter; > + union futex_key *requeue_pi_key; > + u32 bitset; > +} __randomize_layout; > + > #define FUTEX_KEY_INIT (union futex_key) { .both =3D { .ptr =3D 0ULL } } >=20=20 > +static const struct futex_q futex_q_init =3D { > + /* list gets initialized in queue_me()*/ > + .key =3D FUTEX_KEY_INIT, > + .bitset =3D FUTEX_BITSET_MATCH_ANY > +}; > + > +inline struct hrtimer_sleeper * > +futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout, > + int flags, u64 range_ns); > + None of these things belong into the global header. Please move them to kernel/futex.h. Thanks, tglx