From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D863C433EF for ; Wed, 15 Dec 2021 10:45:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BD016B0071; Wed, 15 Dec 2021 05:45:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 26CF46B0073; Wed, 15 Dec 2021 05:45:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 135D56B0074; Wed, 15 Dec 2021 05:45:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 012536B0071 for ; Wed, 15 Dec 2021 05:45:17 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A31FB8249980 for ; Wed, 15 Dec 2021 10:45:07 +0000 (UTC) X-FDA: 78919696254.31.141B831 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf25.hostedemail.com (Postfix) with ESMTP id 5444FA0017 for ; Wed, 15 Dec 2021 10:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ri+zdawudXgxAzscU1cRqkMc+UJ/ZceDl69E/eAootg=; b=bF1U3XaTIPTP8OzTZo/py3pL1n HeIi5p+wrTocF4lUzT4+WF7Uq5b49yYOANErk8pFisKWn0r1Y0PzUVZP1UWlzn5CKIlUfPNRyy/A5 dFQG8x3mpfmuh8FCl2fO0mlZQwzLHD5nPoweoGFYryCLvxhf+hDUkz0CCiz4DoPEdxkwHeZbbjyOb PNu/hP9gyONi03R84gugzTBWGA5DpC6rY/n86zDWnjHhUrG/mrEarrCnj+S2jh3jccKmuW0kF0EuL pa75hefUOMCP/on2MW9l3iEjSbiyXfU57TwSITSmJH1ZWAVa9FXXuoe6FF/k+rYgOYRWbx0H3o9md 5sYHl95g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxRmE-001URT-C3; Wed, 15 Dec 2021 10:44:50 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (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) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6497330003C; Wed, 15 Dec 2021 11:44:49 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0B9EC2B3206F8; Wed, 15 Dec 2021 11:44:49 +0100 (CET) Date: Wed, 15 Dec 2021 11:44:49 +0100 From: Peter Zijlstra To: Peter Oskolkov Cc: Ingo Molnar , Thomas Gleixner , juri.lelli@redhat.com, Vincent Guittot , dietmar.eggemann@arm.com, Steven Rostedt , Ben Segall , mgorman@suse.de, bristot@redhat.com, Linux Kernel Mailing List , Linux Memory Management List , linux-api@vger.kernel.org, x86@kernel.org, Paul Turner , Peter Oskolkov , Andrei Vagin , Jann Horn , Thierry Delisle Subject: Re: [RFC][PATCH 0/3] sched: User Managed Concurrency Groups Message-ID: References: <20211214204445.665580974@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 5444FA0017 X-Stat-Signature: qp9epxn33gwgmifouhaxwksge48aw4yj Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=bF1U3XaT; spf=none (imf25.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Rspamd-Server: rspam10 X-HE-Tag: 1639565101-766140 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 14, 2021 at 07:46:25PM -0800, Peter Oskolkov wrote: > Anyway, I'll test your patchset over the next week or so and let you > know if anything really needed is missing (other than waking an idle > server if there is one on a worker wakeup; this piece is definitely > needed). Right, so the problem I'm having is that a single idle server ptr like before can trivially miss waking annother idle server. Suppose: umcg::idle_server_tid_ptr Then the enqueue_and_wake() thing from the last patch would: idle_server_tid = xchg((pid_t __user *)self->idle_server_tid_ptr, 0); to consume the tid, and then use that to enqueue and wake. But what if a second wakeup happens right after that? There might be a second idle server, but we'll never find it, because userspace hasn't had time to update the field again. Alternatively, we do a linked list of servers, but then every such wakeup needs to iterate the whole list, looking for one that has UMCG_TF_IDLE set, or something like that, but that lookup is bad for performance. So I'm really not sure what way to go yet.