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 X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABE80C00A89 for ; Mon, 2 Nov 2020 20:13:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E2B1621534 for ; Mon, 2 Nov 2020 20:13:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="BTHdDe/Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2B1621534 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2BA326B0036; Mon, 2 Nov 2020 15:13:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 26AC66B005C; Mon, 2 Nov 2020 15:13:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13F956B0068; Mon, 2 Nov 2020 15:13:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id D23DC6B0036 for ; Mon, 2 Nov 2020 15:13:00 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 74A92180AD801 for ; Mon, 2 Nov 2020 20:13:00 +0000 (UTC) X-FDA: 77440576920.22.spark46_5a06fc7272b2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 4C85118038E67 for ; Mon, 2 Nov 2020 20:13:00 +0000 (UTC) X-HE-Tag: spark46_5a06fc7272b2 X-Filterd-Recvd-Size: 5132 Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 2 Nov 2020 20:12:59 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id h6so19079969lfj.3 for ; Mon, 02 Nov 2020 12:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BfkxRNzQnOQz526t0caSAxJWJI9EB2Dn3+3X+59nRvY=; b=BTHdDe/ZjX/qC5aHm0OqZtcdBHrIGftnZZmWgsu9gn7lwARE/V9mxpUy4noxzFLfCe VtAvMiSfaYzK07I8XXQO84s0N8BKOLOzGK3P+lDwyoFffEGHOeZCAnjI4H8LMg6c7Z3K 5bimHK+ZzJxg27Fb4MsOQgQn69x9LJtupIADc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BfkxRNzQnOQz526t0caSAxJWJI9EB2Dn3+3X+59nRvY=; b=bUA7ebxi02YbWorH7REKYHQIlHCUWPGe7I6CgM9AxGTN5YHjDAw9heYY7o2v4chvuM 7Q+dYvsZ4WfS8bjVvTk91R5/yoAVkCLXGxjaBOxsjMVpm6O4rtUYlbJhmfSgJsdGR6Yi VVu7cdPl3hIDJWndJAbc6g6Q5I1KC8kAU2lq82Xzr/P08KChFk9BUxiI2G/bFfjDK1M1 jCq4tyrMXmSYfVLDYNUhRBNx82e72H08KBTI3SeJK/bEEFLkX0zXbJuKaiRQ9rwiYoCa ihPf3aj3dWanCm3LSCXX6trgdLfBway4dXX4uQ2y+DIilOKWxO7a7kEj0atQ+hg2S3D9 1Ztg== X-Gm-Message-State: AOAM530OqAE1QuRpaFP5Og3+5Ha4UEiFdPIloFFzlf+E7k+kZLpzzyw8 RV+ZwWuDdlgkFE0dFuBGygdZfHrOheUtVA== X-Google-Smtp-Source: ABdhPJwcuJT6yDwzJ17fBrJhe/EA2JKoNA2IJomdp6diP540nWX4eGoYpwi3ywAJPhbdMZhkrdjx3Q== X-Received: by 2002:a05:6512:36c5:: with SMTP id e5mr5579896lfs.433.1604347977664; Mon, 02 Nov 2020 12:12:57 -0800 (PST) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id r3sm2649299lfm.287.2020.11.02.12.12.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Nov 2020 12:12:53 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id l28so19035168lfp.10 for ; Mon, 02 Nov 2020 12:12:53 -0800 (PST) X-Received: by 2002:ac2:5f48:: with SMTP id 8mr6842069lfz.344.1604347973214; Mon, 02 Nov 2020 12:12:53 -0800 (PST) MIME-Version: 1.0 References: <20201101170656.48abbd5e88375219f868af5e@linux-foundation.org> <20201102010804.uENOQsZO9%akpm@linux-foundation.org> In-Reply-To: From: Linus Torvalds Date: Mon, 2 Nov 2020 12:12:37 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 13/15] epoll: check ep_events_available() upon timeout To: Soheil Hassas Yeganeh Cc: Andrew Morton , Davidlohr Bueso , Eric Dumazet , Guantao Liu , Khazhismel Kumykov , Linux-MM , mm-commits@vger.kernel.org, Al Viro , Willem de Bruijn Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000290, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Nov 2, 2020 at 11:55 AM Soheil Hassas Yeganeh wrote: > > Given that you're calling ep_events_available() under lock, I think > this should address the inefficiency for the non-racy timeout case, I > mentioned above. The remaining races are preexisting and all result in > spurious events, which should be fine. Well, they might result in not seeing events that are there, but for that case we end up going the logn way around and doing the "wait for events" code, and that should take care of it, I guess. So it's racy, but it gets fixed up later regardless of which way it races, I think. It might be worth a comment or two. And that "goto fetch_events" thing might be worth writing as an actual loop, rather than the pointless one I removed. I suspect that old pointless loop might have been historical (some kind of "loop waiting for event"), since that's how those things are usually written. I didn't go and look at the history. Anyway, I've dropped the original 13/15 patch, buit I'll apply the test-case one (14/15) even if it might now fail in the current state. I hope that you will end up submitting some cleaned-up (and tested!) version of that patch I cobbled together - I'll archive this thread for now on the assumption that the resolution of all this will come back to me later... Linus