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 CF60DC433F5 for ; Thu, 27 Jan 2022 18:47:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28DAD6B0072; Thu, 27 Jan 2022 13:47:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 23D2B6B0073; Thu, 27 Jan 2022 13:47:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1059B6B0074; Thu, 27 Jan 2022 13:47:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id 016976B0072 for ; Thu, 27 Jan 2022 13:47:14 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id AFD81181F6E66 for ; Thu, 27 Jan 2022 18:47:14 +0000 (UTC) X-FDA: 79076949588.10.E55AE15 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by imf27.hostedemail.com (Postfix) with ESMTP id 1B5AF40006 for ; Thu, 27 Jan 2022 18:47:13 +0000 (UTC) Date: Fri, 28 Jan 2022 02:47:08 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1643309232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lKkvOop6NBVOz4myJcJLCtPSQ/pPLA6YNYvDUwSzWJ4=; b=ql3pdQZqzgSNQx7urPCbVYqgUhXgY2dDoca6ITOB9uk7Z7y+jziWdFN+HH4EctHL2OotPO xCEg5xYnWPXObr6N0yZInYF0yhqhfK2V3Gm87xbMOHQcY7eDUR5MSeySAvcFvvI7zyuh1G fj9JxF6CRWX27HJ/xEU1aEciWim9ryE= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Tao Zhou To: Peter Zijlstra 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, Tao Zhou 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: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1B5AF40006 X-Stat-Signature: pmp5ppnty1x5cizwj5mx8g7bkoap1cte Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ql3pdQZq; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf27.hostedemail.com: domain of tao.zhou@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=tao.zhou@linux.dev X-Rspam-User: nil X-HE-Tag: 1643309233-548062 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jan 27, 2022 at 01:25:36PM +0100, Peter Zijlstra wrote: > 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. That's right, I miss that. > > 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. But, it's my noise though.