Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1233565imu; Thu, 13 Dec 2018 11:32:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/X+dnJiI7b6TsIp2yP3XdPCDseFE457FTPh/LPq9mSlJ5pPPo2qvdxiYms+FyFPCsdgvi3C X-Received: by 2002:a17:902:9691:: with SMTP id n17mr70264plp.9.1544729534397; Thu, 13 Dec 2018 11:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544729534; cv=none; d=google.com; s=arc-20160816; b=Nz+ziUfEM/NXN90M8uFXORVhybSs0vO3tyQ4JC3Uf0HAo2H62CCJTlhuATZysnHt2o NNt7ARhESw6vdKuM+aAMMlrYROzIa4rLgfLHROJ2z5LgkKNFV9RRh7g6vR9+Byb7U7Eg BpAPMpsKHFq79VLi3mtT9s/oNNildeL37xEri7v7NVhBfA8mD4Wh8fTePy/pZaBaA+GE 0tzc5HT0Q6HvL3sOuTR0Btw1L/7YVXQIYcoABrkKExXsBNALz3bzXx2yxJMeoknYhHZH 06CY7nfwST21etWexj9Q3PFahCecBK9pmHiw59iNaw4LxkWO0MTLQTq2zWLGIMdatQGP nEuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:organization:subject:cc:to:from:date :content-transfer-encoding:mime-version; bh=EHt2Mqhivb22uiR0aPgq9bsSgYAkuwnO9GR7/ZbtbPU=; b=REJRWb87tFXKrMI3FW0woaqBI7ydfvX6thVAgZKH5mRyUoXiX6Jas2rZod8ouiCylq aCRfHQPAtiyami17tqvoxFU5ERtoACscE9bVOkZkW0dIJxU4lSbePMS9AdXnZrYgbxnJ 83jn8jh5D07lXWmSEniIvS690dUPmcuxj7iDI49e6qmZU2UHdyRVvIdk96UkuYEOcRg5 hHtoC0FOQclPDBQ4wMTiP08VROUShACfRjlyhgeU0KAwwbFpx0uoqYZcXq8YHsZF4Zf+ jYwNiDTBF53tPW44H3kPaCzr82Zw411aK5JrC9m9fdsh1q+tOzS87QFli14y8e8z6gKj eDCw== 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 t64si2038281pgd.202.2018.12.13.11.31.59; Thu, 13 Dec 2018 11:32:14 -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 S1728228AbeLMTal (ORCPT + 99 others); Thu, 13 Dec 2018 14:30:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:42552 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727682AbeLMTal (ORCPT ); Thu, 13 Dec 2018 14:30:41 -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 205D5B005; Thu, 13 Dec 2018 19:30:39 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 13 Dec 2018 11:30:38 -0800 From: Davidlohr Bueso To: Roman Penyaev Cc: Jason Baron , Al Viro , Andrew Morton , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] epoll: make sure all elements in ready list are in FIFO order Organization: SUSE Labs In-Reply-To: <20181212110357.25656-2-rpenyaev@suse.de> References: <20181212110357.25656-1-rpenyaev@suse.de> <20181212110357.25656-2-rpenyaev@suse.de> Message-ID: X-Sender: dbueso@suse.de User-Agent: Roundcube Webmail Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-12-12 03:03, Roman Penyaev wrote: > 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. So the window for which the ovflist is used can be actually non-trivial (ie lots of copy_to_user) and I just hope nobody out there is relying on particular wakeup order. otoh nobody has every complained about this "reverse" order and not having the perfect queue. And hopefully the same will be for this case. With that: Reviewed-by: Davidlohr Bueso > 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); > } > }