Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1txAki-0046PK-Fm for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Mar 2025 20:20:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1txAji-009O3X-Dh for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Mar 2025 20:18:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1txAjh-009O3N-SX for pgsql-hackers@lists.postgresql.org; Tue, 25 Mar 2025 20:18:58 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1txAjf-00194Y-14 for pgsql-hackers@postgresql.org; Tue, 25 Mar 2025 20:18:57 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-22622ddcc35so831115ad.2 for ; Tue, 25 Mar 2025 13:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1742933933; x=1743538733; darn=postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=MJDkbwwb4k/dzJ4wR1AsrZuJiJ+aLxwrPN/KNwr/oJc=; b=Y3UK1PiUK99brRMhN9rc9z0kyejimKss0ZYPQ+iNNNHzSu/n4W2SoLt/keMdWmI+Gn eKxqpFz5zrwBxNQjKRW9m9C2Kwh3oHossHvfN/mUq3MmEwE5094xaeG5xH0hF6xTepws d63GtKldINObTtEE0sRdMX4z3q9v9mjTHGuck= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742933933; x=1743538733; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MJDkbwwb4k/dzJ4wR1AsrZuJiJ+aLxwrPN/KNwr/oJc=; b=mvYJYn/A/E1kfyPVnVhLoT9BrdnDplJq4JD1JGblhOhROXMwaEj8EQU1nMj1ITvgM7 idAHJ1PlhGGoVNue7G+k+7SjE7w9IgPlXB/gCHDKAtKAIG0TsXqthcMdMyxFzQB0X4vn h+HeXDSvxo1XZwR8/+KRwQnf2TPOr3QCCJGqQDLGb4m0KedYwrlIs6PnsnphVJ0I+dWr 53FpaMOEF9yM4LqutWUvOYQGymLD/P9yU6EIeErpVOwrBS1iaaUhBfrnN+v9p+IdOlsJ BpZhrh9MLGScJoes3Lpz2PGOHHcUPZLHfsNgmR1RWCcYPalsyaQbga0c40BlySV9xrJO 0rQw== X-Forwarded-Encrypted: i=1; AJvYcCUrs0b0NA+3HJRK3klPf7sWVX1T0XrTJ3FuLI+tpx0sH72AEndfRbm0gtTZNSyTL0/I1kD4x/uUJVM0Gdtl@postgresql.org X-Gm-Message-State: AOJu0YzPyA1U4dmBT12TSZlkQuXWpWnoz1Ng2s9De0bBbIzdBCkj9CqL WJUoPD4svdEoGtwvgfqKwwwRS6ZKkEuecQ/G6cz7pmD5RzAi07E1v9YjUCW2dA== X-Gm-Gg: ASbGncuMTKMtXsdCI7/0YL9K43UkfFRIZZI9gUELSzgPzKyQz2v2kpkeyYUZIBOfx8Y H/bR/5hdjP2dHprqd5HaYOO1ECeNfYeDqgYMB02V9oR6F2oD8hP32UFTYvtBh2dI4HWu786ehHT 2ULyigRuKpe6nrZ4me4K9htjbenFzp+iLhGiOBUrBIV7Fi3cbmBBYDiuhd9bRj2u3xLJixX8Zpu CLkEaIyBVeL/LmzUJsM+HSxiujS1UPKrWXeHjm1HrY/JQm4x+Ph+I//s4+W28C2zEeB/F8zgCUA PbUuRukR+cyxeM6zyt6YRNQBkp0UTMjuxaKSutT7Og== X-Google-Smtp-Source: AGHT+IHAwM29hBceNnwSqY3qEZpKNbCJYFZEaTwzFD1jmyjfRqCktEfiioil0sayO8qWfZtB76WDRA== X-Received: by 2002:a05:6a21:b90:b0:1ee:dded:e5b with SMTP id adf61e73a8af0-1fe42f9bb33mr32059841637.24.1742933933048; Tue, 25 Mar 2025 13:18:53 -0700 (PDT) Received: from google.com ([2601:647:5600:80d0::31cd]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73905fd57f7sm10641432b3a.44.2025.03.25.13.18.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2025 13:18:52 -0700 (PDT) Date: Tue, 25 Mar 2025 13:18:50 -0700 From: Noah Misch To: Andres Freund Cc: Thomas Munro , Antonin Houska , pgsql-hackers@postgresql.org, Heikki Linnakangas , Robert Haas , Jakub Wartak , Jelte Fennema-Nio Subject: Re: AIO v2.5 Message-ID: <20250325201850.55.nmisch@google.com> References: <20250325004537.17.nmisch@google.com> <20250325133321.54.nmisch@google.com> <20250325155808.f7.nmisch@google.com> <5ons2rtmwarqqhhexb3dnqulw5rjgwgoct57vpdau4rujlrffj@3fls6d2mkiwc> <20250325193956.57.nmisch@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Mar 25, 2025 at 04:07:35PM -0400, Andres Freund wrote: > On 2025-03-25 12:39:56 -0700, Noah Misch wrote: > > On Tue, Mar 25, 2025 at 02:58:37PM -0400, Andres Freund wrote: > > > There are 2 1/2 ways around this: > > > > > > 1) Stop using IOSQE_ASYNC heuristic > > > 2a) Wait for all in-flight IOs when any FD gets closed > > > 2b) Wait for all in-flight IOs using FD when it gets closed > > > > > > Given that we have clear evidence that io_uring doesn't completely support > > > closing FDs while IOs are in flight, be it a bug or intentional, it seems > > > clearly better to go for 2a or 2b. > > > > Agreed. If a workload spends significant time on fd.c closing files, I > > suspect that workload already won't have impressive benchmark numbers. > > Performance-seeking workloads will already want to tune FD usage high enough > > to keep FDs long-lived. So (1) clearly loses, and neither (2a) nor (2b) > > clearly beats the other. I'd try (2b) first but, if complicated, quickly > > abandon it in favor of (2a). What other considerations could be important? > > The only other consideration I can think of is whether this should happen for > all io_methods or not. Either way is fine, I think. > I'm inclined to do it via a bool in IoMethodOps, but I guess one could argue > it's a bit weird to have a bool in a struct called *Ops. That wouldn't bother me. IndexAmRoutine has many bools, and "Ops" is basically a synonym of "Routine".