Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1041573lqh; Sun, 5 May 2024 13:17:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDRumxpvbsX9rkpi63kitFL/tVO48fQ6/WpO0Zfwc5XtOFVI3snqwrZl0fnZNzva+x8sPYTZmdpEbP24QtddyWXzRmsaUq4Bj740qPpQ== X-Google-Smtp-Source: AGHT+IFCFddZMhuDm5l/AZAVgGPTh42+7DuORqJY7zBNMHuRQkAjLC5oTBV5GoxZUS9MWnCFeknR X-Received: by 2002:a05:6a20:970f:b0:1a7:63ce:84ce with SMTP id hr15-20020a056a20970f00b001a763ce84cemr8005531pzc.49.1714940254815; Sun, 05 May 2024 13:17:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714940254; cv=pass; d=google.com; s=arc-20160816; b=skpFN1PTKWgWJZOuI4DeIEmFJGElTHMc20ygcj5O12NDzCDlH8pG82WVlKcVllalwh nw93f3LJIPu6xqvtQc3Nys1rCUU7FsOD7q5CWelSm/AaSqi+we3RP7kZsZA4ig6yPEzl BQHHIxGrC9kTX4nVWNSFtKoxhSSaSzEiWsxupCNM6SrVidF8kddhm8bfRkVKRFo7+n8L UYb8fz8qcVmdQzLwcAw11NEDQQ7ERd9x3E35HhBVzKOhNxl1g2VrqRBNpYirn5/UtSba r8yh9nPMBrL4U4i3dimlkGZMxq8ziiTiHWvh7D4M3Z5ua4/y3bpYZC3rrKkhzx24w1ZT 2Txw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=89jyKA3wApx9BQCfs5IiJWmwTiyjcjG5A1RQj5E06Fo=; fh=MGQSc8gQH3ky00IgKj5+UaWkJTfgH/knhDtjfB9Vu+A=; b=LlwQolml198N9IS+z2V8MtUyrzusUHiHH7Ivdd3ckD0+PcVDrmsd7dMMGgQiJaAadx nwAxOLJ4ylCRKfPPxtTE8rSVUHvLiNXqWpG0jEslJOpwn7W31jmn4dBHxsEdUksqPt61 hx9zR3AaZV3BtjXarB5GldjKOcdhdptjuljDVFmFo9pd+Hop0QOvQmYVnDm57XuGRYpA B9B7TdRwR5OCVHYZ24zyptxi2op8LHu55dH3SG7afR7vWu2xDEe80xc2R9O1sbkO1gmk DclX2Bs777jKGM0HMUi8fM9ElkAEHS7eSYNO869gGD8Fz5w6DCRqILEULG2C+gBZskDk i9GQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=TIE6fivG; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-169133-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169133-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m26-20020a634c5a000000b005dc958db2fesi6827896pgl.34.2024.05.05.13.17.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 13:17:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169133-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=TIE6fivG; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-169133-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169133-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C8AA2823BC for ; Sun, 5 May 2024 20:17:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29CE47602A; Sun, 5 May 2024 20:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="TIE6fivG" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D92674C14 for ; Sun, 5 May 2024 20:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714940232; cv=none; b=DQl1/v1YuRTt5ybmkJ9HH0LLV/xOC0P02uRO+vx+Pnjv22kfwqvuaMhPkh5zJM7KkwoFy10JiuanpTa1KufLI/quWtk+i+ZOMKg6+x0Jm0CfyfOiKOJAwZRP+71TnfAj7SSXRRkyBG7AtrOOF3hTAy+yb7BBokaFffUbigd8z2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714940232; c=relaxed/simple; bh=YVUUiZWgMhQe0Pv8Ng+UCkY3LYOanihQ0/5fJzF5CqQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=OuWzXQKdp6N6nii/4sSNIOJuL2iljwIa8Rl+9kYoo/+YaTIa2tuMDvI/VPcDV+G7dcjbjRHG2Rhhy4HC34zU8I7pFfXL17X4WNRWvVmpQIC+IWexU4UG+WyeAm5fk/kLxhuAC9xYeXfOyk2prdLsi4D00l8finB6wNH7zShiQp8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=TIE6fivG; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-51f4d2676d1so1334092e87.3 for ; Sun, 05 May 2024 13:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1714940228; x=1715545028; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=89jyKA3wApx9BQCfs5IiJWmwTiyjcjG5A1RQj5E06Fo=; b=TIE6fivGd9wAkCMMfINu1pQ+4riIGri8T5WnOfDZGn9xEiupO2A8RaHTFbY2spBmny q8wF8IBSPGRHAi+so5pE+cx43/flXlDxkYxmd9JXsZx7eqZon9e2va3iU2jK5feXSiD1 frFMhT3UB31tXaVFW97l7KTrazCbKnOT6jTGU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714940228; x=1715545028; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=89jyKA3wApx9BQCfs5IiJWmwTiyjcjG5A1RQj5E06Fo=; b=Wqgk97Ldnxa7w46Snq/9Rv2T6qlmFSB3MalvRUbsrwZLasionDJn8pq7p9Ozy5kHgN d6gX8nDtu+OlS2XZGgUfsaqwAbNAqg/8/3PLb2iYpDT6eXi2EbYmw4u9vgBAIyRwSqfS UtJzQzy0x09XKEa8toZn8GBxz3HMKct1oo/m/lj/bAb7GzWavQiNSQcpLWIpgt+E/l23 NviDGjSS+0IhmrvRQi2chWQTVj7dU3H6fYbzp+F5FvyDyl+1AMhuRK4Xf5oFsSC+qqp5 Nn3bHwNj2hXc2gxCV5M3BVEQNxQvgDYcRR1rVIDVOy0B90ueGYQVc1nQPAZAUu4kyos2 LZIQ== X-Forwarded-Encrypted: i=1; AJvYcCUQWp4qszmz8+J4KIuPgdDrTlm9PSsQy55DyNRjY7wVe3IYvHNzdIoe2vKnl9VW5xO0qfQ5DXYJFSq8angqbthOHigRVI0nNB5YO1x1 X-Gm-Message-State: AOJu0Yx9eUp1Y6Fx3EgOzqCF0QCS/oz/U2qjHf7USQNhq9seVTd2l9nb cUB+F9UOqfVEKdxZ2bAUJxthajrWeM79KVy6ae6mBYi2qJWxNHzXKSjdqmxcbQGxulagQGfHoaz AArrHjw== X-Received: by 2002:a05:6512:456:b0:51f:4c53:8e4c with SMTP id y22-20020a056512045600b0051f4c538e4cmr5106182lfk.33.1714940228703; Sun, 05 May 2024 13:17:08 -0700 (PDT) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com. [209.85.218.52]) by smtp.gmail.com with ESMTPSA id ld13-20020a170906f94d00b00a59cf137227sm290264ejb.89.2024.05.05.13.17.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 May 2024 13:17:08 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a4702457ccbso288928666b.3 for ; Sun, 05 May 2024 13:17:08 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWWixMXNf9PIWuez4d4jFcX+871w/eV+/H0Ov6OSzhYmO0yIerLhi2XgsywMMsj6fKh2OrphbttzloGXIQ3F++UWw3T2OKfZryV1Vx7 X-Received: by 2002:a17:906:7188:b0:a59:cd18:92f5 with SMTP id h8-20020a170906718800b00a59cd1892f5mr599989ejk.11.1714940227970; Sun, 05 May 2024 13:17:07 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240505175556.1213266-2-torvalds@linux-foundation.org> <12120faf79614fc1b9df272394a71550@AcuMS.aculab.com> In-Reply-To: <12120faf79614fc1b9df272394a71550@AcuMS.aculab.com> From: Linus Torvalds Date: Sun, 5 May 2024 13:16:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] epoll: be better about file lifetimes To: David Laight Cc: "axboe@kernel.dk" , "brauner@kernel.org" , "christian.koenig@amd.com" , "dri-devel@lists.freedesktop.org" , "io-uring@vger.kernel.org" , "jack@suse.cz" , "keescook@chromium.org" , "laura@labbott.name" , "linaro-mm-sig@lists.linaro.org" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-media@vger.kernel.org" , "minhquangbui99@gmail.com" , "sumit.semwal@linaro.org" , "syzbot+045b454ab35fd82a35fb@syzkaller.appspotmail.com" , "syzkaller-bugs@googlegroups.com" , "viro@zeniv.linux.org.uk" Content-Type: text/plain; charset="UTF-8" On Sun, 5 May 2024 at 13:02, David Laight wrote: > > How much is the extra pair of atomics going to hurt performance? > IIRC a lot of work was done to (try to) make epoll lockless. If this makes people walk away from epoll, that would be absolutely *lovely*. Maybe they'd start using io_uring instead, which has had its problems, but is a lot more capable in the end. Yes, doing things right is likely more expensive than doing things wrong. Bugs are cheap. That doesn't make buggy code better. Epoll really isn't important enough to screw over the VFS subsystem over. I did point out elsewhere how this could be fixed by epoll() removing the ep items at a different point: https://lore.kernel.org/all/CAHk-=wj6XL9MGCd_nUzRj6SaKeN0TsyTTZDFpGdW34R+zMZaSg@mail.gmail.com/ so if somebody actually wants to fix up epoll properly, that would probably be great. In fact, that model would allow epoll() to just keep a proper refcount as an fd is added to the poll events, and would probably fix a lot of nastiness. Right now those ep items stay around for basically random amounts of time. But maybe there are other ways to fix it. I don't think we have an actual eventpoll maintainer any more, but what I'm *not* willing to happen is eventpoll messing up other parts of the kernel. It was always a ugly performance hack, and was only acceptable as such. "ugly hack" is ok. "buggy ugly hack" is not. Linus