From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81BB439ACF for ; Fri, 11 Jul 2025 05:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752210146; cv=none; b=rnRZmQVvwBGXstAlGomdOb4MU8DAcW9wBuwwKXLuIqbfWHSHAxUEvPyJ5C6pBOMPkR9EQc6xt+ZDTTPEK1xtDJSzXjypCpL8b/2gvvdCHbtjHT/OLPw1CnkEHf8DfIP/qOovpQy9J6VLO0aveLP6EIy2QFUhpX5+Q4EQk5UWkHM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752210146; c=relaxed/simple; bh=2QSoiblwx9XXddcQYzdxBSa861AciILCjKcc0UKEJWA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hiwVqsRTd7dahbWBMbKX3pfydaCQJ0Wz42cBhJLIxK3sWIGhyQQIujtV2Eac86R2Y7P0K9l/k2xMozQVSIBfxEuEjC+HMTIJ23N15Y3ROgJksLFd6ShylMQZE0gEO7lLhOfvlM2sb7xyc73Z40cvNKmz5ssZQBURpcYk8jupfyU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=02M1NCoI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=EwYVL3Dw; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="02M1NCoI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="EwYVL3Dw" Date: Fri, 11 Jul 2025 07:02:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1752210141; 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=j59WDD2gzvtudEauuDI9ce9YLhlsFVKD79WIDcOOSs8=; b=02M1NCoIj98kR14JGLLJCmJunjqalyyp5w1aBhNpNyZEkBXB3qEIbHFPkDTWG3xqaXJhxN Q/cqnEI6pkT8rJh9/2z3DFadzSmnnIROhkboDAeDR9qtsJdVWkc+1SthIcCy/+4TVshoSO 7eKD1bXnkksyiiYfKFoE8ukym+O2aYGQN/qcPF+wuXGAjaJtZUY6/7oHIgoRl2hcgrdLWO ZsB0g+i9IhenPPrXt/nDZ2l5ojrs+g1SWMoCP8RUmDVoJvF5ueFE7c61JZpWtdMTpiRtzq FaqptMLai1sGpNBH0U1mprMmLFYBrSvahfy22APApvKAN98MHFJkp/cQygE7TQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1752210141; 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=j59WDD2gzvtudEauuDI9ce9YLhlsFVKD79WIDcOOSs8=; b=EwYVL3DwHtOVB+v4a+urbtpc1WXH1/pTVPYxd5AOoIkqidGHSkm0D6hBmHgQMIx0g9KC8K Lctr6nJR+E/yAxDw== From: Nam Cao To: Xi Ruoyao Cc: Christian Brauner , Frederic Weisbecker , Valentin Schneider , Alexander Viro , Jan Kara , Sebastian Andrzej Siewior , John Ogness , Clark Williams , Steven Rostedt , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, linux-rt-users@vger.kernel.org, Joe Damato , Martin Karsten , Jens Axboe Subject: Re: [PATCH v3] eventpoll: Fix priority inversion problem Message-ID: <20250711050217.OMtx7Cz6@linutronix.de> References: <20250527090836.1290532-1-namcao@linutronix.de> <20250701-wochen-bespannt-33e745d23ff6@brauner> <20250710034805.4FtG7AHC@linutronix.de> <20250710040607.GdzUE7A0@linutronix.de> <6f99476daa23858dc0536ca182038c8e80be53a2.camel@xry111.site> <20250710062127.QnaeZ8c7@linutronix.de> <20250710083236.V8WA6EFF@linutronix.de> Precedence: bulk X-Mailing-List: linux-rt-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Jul 10, 2025 at 05:47:57PM +0800, Xi Ruoyao wrote: > It didn't work :(. Argh :( Another possibility is that you are running into event starvation problem. Can you give the below patch a try? It is not the real fix, the patch hurts performance badly. But if starvation is really your problem, it should ameliorate the situation: diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 895256cd2786..0dcf8e18de0d 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1764,6 +1764,8 @@ static int ep_send_events(struct eventpoll *ep, __llist_add(n, &txlist); } + struct llist_node *shuffle = llist_del_all(&ep->rdllist); + llist_for_each_entry_safe(epi, tmp, txlist.first, rdllink) { init_llist_node(&epi->rdllink); @@ -1778,6 +1780,13 @@ static int ep_send_events(struct eventpoll *ep, } } + if (shuffle) { + struct llist_node *last = shuffle; + while (last->next) + last = last->next; + llist_add_batch(shuffle, last, &ep->rdllist); + } + __pm_relax(ep->ws); mutex_unlock(&ep->mtx);