Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1715677imu; Wed, 12 Dec 2018 03:06:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/VMRg4hA3bSHC/Hq1cwQxqLBdP0z6lT+73g/HvrpXrZxuclBQS0wbsR8lbMXxcMGrppsHEQ X-Received: by 2002:a17:902:2b84:: with SMTP id l4mr19536049plb.191.1544612793477; Wed, 12 Dec 2018 03:06:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544612793; cv=none; d=google.com; s=arc-20160816; b=EfpZZAXpl7yVlWccu4xcuDDCTOtlG9DMOWsa2mBa9sVousPAK4/k34J5iesHuh0336 RgF5aG5RObCsJaA8iqM+tbVFe0awhTEK3JzMOvkDzaOjfnrNH2fRbbsA+VWpChzly02P 58UNqYTxkivFlbAL5FaFZemP3ncDiyvIlXUn6CPauq4Z57swz8XzOzF9PqNMOMnKiKjx bmL8fDbk5SPjy+0h3T+27CJsAF/4FfGZArNgWmipTk/DU8rZs3k8eRAJdl6MZ4+4OzCu rxCcmAeURxMnSuXBaNK3sfRe64/1a4d/nvPG+AqbmYoR+EQ/KYAvPaT6T3FDsjorfyAU 7ysA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from; bh=35EDIPeeOeUlukRmc3jK6JlhpAa+ivaLvaFOO5lCgEY=; b=Zd1KTYorrf2PI2QCIGavoG7HqxBCMMM1YwZS9vinZr8VSmuhZWRK+awDxXI3n0c6Xp CFiqEmVeI968WEqLDIVJCXIE93NaL3D/aZ8F3vU9wv7kKTokWzA4LOVUT3FDbFQ0SA6Q UHDUxTu9Tf/HXbQPmowtfQCoTELLxpOx/h6w5nUaosShM4Pb/dI9EoS9oy3GOZa545yL KAQYpq3frNsHYjXTrUFiQJaLsSfaNkUBlxTS3xUaYifYeBV0m4UvzEZlc77GZ63spvaQ jHCSyGbCaBnde1Kjk3/iXsyy285vs59jj3xvZx9pLxaP09XCQbxRU4X+9rfz5Uz0uTJ4 dfqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 28si18340671pfm.50.2018.12.12.03.06.18; Wed, 12 Dec 2018 03:06:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727284AbeLLLEd (ORCPT + 99 others); Wed, 12 Dec 2018 06:04:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:46018 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726970AbeLLLEd (ORCPT ); Wed, 12 Dec 2018 06:04:33 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 63E23AE8A; Wed, 12 Dec 2018 11:04:31 +0000 (UTC) From: Roman Penyaev Cc: Roman Penyaev , Davidlohr Bueso , Jason Baron , Al Viro , Andrew Morton , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] epoll: make sure all elements in ready list are in FIFO order Date: Wed, 12 Dec 2018 12:03:55 +0100 Message-Id: <20181212110357.25656-2-rpenyaev@suse.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181212110357.25656-1-rpenyaev@suse.de> References: <20181212110357.25656-1-rpenyaev@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All coming events are stored in FIFO order and this is also should be applicable to ->ovflist, which originally is stack, i.e. LIFO. Thus to keep correct FIFO order ->ovflist should reversed by adding elements to the head of the read list but not to the tail. Signed-off-by: Roman Penyaev Cc: Davidlohr Bueso Cc: Jason Baron Cc: Al Viro Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- fs/eventpoll.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 2329f96469e2..3627c2e07149 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -722,7 +722,11 @@ static __poll_t ep_scan_ready_list(struct eventpoll *ep, * contain them, and the list_splice() below takes care of them. */ if (!ep_is_linked(epi)) { - list_add_tail(&epi->rdllink, &ep->rdllist); + /* + * ->ovflist is LIFO, so we have to reverse it in order + * to keep in FIFO. + */ + list_add(&epi->rdllink, &ep->rdllist); ep_pm_stay_awake(epi); } } -- 2.19.1