Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp63573pxb; Thu, 27 Jan 2022 15:09:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJybnXzJJBY4EPwc81BU5kYbEn6ops0DlpurZ1vxDfjgk3JKBGCKLeb2Nior3hFg+8oVQMd8 X-Received: by 2002:a05:6402:b6a:: with SMTP id cb10mr5613945edb.191.1643324989499; Thu, 27 Jan 2022 15:09:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643324989; cv=none; d=google.com; s=arc-20160816; b=X/6v9ex3uFti/MPu0n7hmd93Hy1lHVo2km5fJSfgimZQr9oBBqSArqAVALZlrTcvEU Pt/3FA7JqbQPzzDM+Ix9ipBYv+TukV8cT+gLu1LcwzOF92LZpdPPpssrHkmLmmwI/4oZ FA0jyug2hOarWYVEO6kM1bCmie151Uqi448Z8eoLFNW7m7htUx8csgKX7eqXDotxgjSq 06hNqPISJfwID3PvHrGZJ6gwbeCZp3ouB2XPfbEugnVnI7LI23cZ6qoFmqyRzfGZ7Zm6 XhaCuxMrW2rfYUMwpSaQMEwBRl1Leg7yHRBiG9k/xPw9/Mb20SMdD1YCHIHDudW+vE8E sUNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ahwv7/f/d1wI1UunAeceetp1H08EJfVU7XPnkABFG5E=; b=GyR6kWH6+eYOl95q0S9TVGFLWtwWJjLGS9S0e4V1pTxcf7dYcTuOmwyenLcYr9yi2F hc1FCc4JLG8nsfImkNRlzDbO0GuXmzKuD0Koi8B2X3+2l8L3AfDNhxTfseO/3fMziR5l GuFOV3GnmJVoM8lymkfsf+qFXpHJ09jlzMoZIgiv1yi3xsApG8TzvuUftkilBccSxSoJ carY1VTbdoL7pwER6JUvi+46yJMqK5mBjp5NPVOSTL210GDc+T/sdqJVil8zeUj7mWKw zE2e4V2oxdfs6qIxGuA7rqOJxkCyT+RGl8Xsqd2RjKVQtzcPe6tctjA9UAyBkmn0feeT UjVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QkAOsFVI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gm1si2249326ejc.14.2022.01.27.15.08.43; Thu, 27 Jan 2022 15:09:49 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=QkAOsFVI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234565AbiA0M0I (ORCPT + 99 others); Thu, 27 Jan 2022 07:26:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbiA0M0G (ORCPT ); Thu, 27 Jan 2022 07:26:06 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB41AC061714; Thu, 27 Jan 2022 04:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=ahwv7/f/d1wI1UunAeceetp1H08EJfVU7XPnkABFG5E=; b=QkAOsFVIQVeugYoeLMuS21eVwD BPmC8JFQCcJ4j9NVkMK1OFcsyWA3Tkm7FFOi7HuM1PBggbDhWMqIKRzHGyjCY1XeIJ5Iy5RrzrI1W nDbb/gk7KRI4ZfAgC7LSPOJHCcuYP/4JXeOwWFiQRi2/JadQN+LF3j7bKnm03Y5i2ZaV9zUcRsPk5 VtmR2g5tvIR7Tbzm68LEAo6JfUfrL1uLEHuooRYgj8TfV+iqaJwFmHurvZhTvPwDLOPhURFH4K6ut x5MDR++uZsIdyI3fliKhXwUvc3cFDlYxI6JBO/MuLkXcAxUQKuQERqQDfdIqpSgAnvGrOsQOMHJpq GL0giNMQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nD3qN-005D5r-8h; Thu, 27 Jan 2022 12:25:39 +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)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 14290300268; Thu, 27 Jan 2022 13:25:36 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BBFA12B52092A; Thu, 27 Jan 2022 13:25:36 +0100 (CET) Date: Thu, 27 Jan 2022 13:25:36 +0100 From: Peter Zijlstra To: Tao Zhou Cc: mingo@redhat.com, tglx@linutronix.de, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, x86@kernel.org, pjt@google.com, posk@google.com, avagin@google.com, jannh@google.com, tdelisle@uwaterloo.ca, mark.rutland@arm.com, posk@posk.io Subject: Re: [RFC][PATCH v2 5/5] sched: User Mode Concurency Groups Message-ID: References: <20220120155517.066795336@infradead.org> <20220120160822.914418096@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 10:46:17PM +0800, Tao Zhou wrote: > > +/* Called from syscall exit path and exceptions that can schedule */ > > +void umcg_sys_exit(struct pt_regs *regs) > > +{ > > + struct task_struct *tsk = current; > > + long syscall = syscall_get_nr(tsk, regs); > > + > > + if (syscall == __NR_umcg_wait || > > + syscall == __NR_umcg_ctl) > > + return; > > + > > + if (tsk->umcg_server) { > > + /* > > + * Didn't block, we done. > > + */ > > + umcg_unpin_pages(); > > + return; > > + } > > + > > + umcg_unblock_and_wait(); > > umcg_unblock_and_wait() -> umcg_enqueue_and_wake() -> > umcg_wake_server() -> umcg_wake_task(tsk->umcg_server, ...) > > tsk->umcg_server is NULL here and umcg_wake_task() use it to update > state in umcg_update_state(NULL, ...), that means tsk->umcg_clock > will happen something i do not know. I think umcg_unblock_and_wait() will repin, at which point we should have tsk->umcg_server again. > There are two places to call umcg_unblock_and_wait(). One is in > umcg_register() where the server is set. Another one is in > umcg_sys_exit() where the server is not set. May use a bool to > indicate if the server is set. I'm not sure what you're on about, but I absolutely hate redundant state, that only leads to problems.