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 1twAmo-00BQQ7-UL for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Mar 2025 02:10:03 +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 1twAmn-007Fpy-HL for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Mar 2025 02:10:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1twAmn-007Fpp-5q for pgsql-hackers@lists.postgresql.org; Sun, 23 Mar 2025 02:10:01 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1twAml-000bGp-0K for pgsql-hackers@postgresql.org; Sun, 23 Mar 2025 02:09:59 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-2239c066347so72923755ad.2 for ; Sat, 22 Mar 2025 19:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1742695798; x=1743300598; 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=qleo2s3/HX26ofqMrsHuIOFaMR8Q32Sf0Lw17UPhWCA=; b=JsndkmZyZH7rk0X47goWRdVvaPwebC5wvr7SI5c6z2bV41NC5wUWQxEPZ2DSrB1R7k h2nDZqI3vJHG6q0fdwIjnEemKJjzK5T4dVBImW2TSj+8ok/IiMcQjqagnRFYBlXSVaKu K4DYCL3cGMbAYCG7sVFUVnmuIKFwrrn1hWrbc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742695798; x=1743300598; 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=qleo2s3/HX26ofqMrsHuIOFaMR8Q32Sf0Lw17UPhWCA=; b=cWx/+tm6X/cCr1xa3ESvOcZ9B+TdWexhU+N5l3od04e+GzHUsb9BMBW+IvW0JI7IrL lAuOY/TRtKvtjXRao8GKsR1BGJTsUQ4jand+I7Lex5n7NFwrdgRMwQm+Fu+RNkDwDzx9 V+DWRL/aIV+djdeid9oDn6xtPVAoLHO1bH2wp+O1IkNMa4I2lwH6O87n/9VpKPEmI39Y qcg/wB2AaJgAPX2dAH9x7ZGprhDaudPxY3Z8IijAwcpNrRNM+rQW2ftIVkmT2uI8qHbS ghWCtWiAOAC/Tbn68CLYjclcjEjfZFR0JILRRi/46aCd/dsGQC3wdYUXKMoBUl+97cSB 0tEQ== X-Forwarded-Encrypted: i=1; AJvYcCVYgOYH7DU+P364+U1Xw0mZPxvjpL4oSDVkil2XnNdtl6YhIBYQpJsgCKIU8SGvWQ2L4Cy4V4VoSc2aj62d@postgresql.org X-Gm-Message-State: AOJu0YzarKPSk9VJdFkq3V12HOsVVjwONCnOhrI6azAwClBl0TiZbzwU EclBIzyzMIwxGxogXaULs4uSAsRiSv1DHkH8zcGH8Wt6Gf3bVETpKpv5eT5MeaAi18gKe3RKfYs = X-Gm-Gg: ASbGncvAMBu+5ZGdfSYPVbhe6TnmZws6lfBZHYs8r5wGUc6e3bgZbwrWw1I40pIs/Hf ITaM4qspx/gkA1VB4AYCNOGo4gUoSlP59+i6GvOwhs9fQBnimlD5fjoe+Bo0zugZYYsOf3Cds14 cSJMebPwmz62J53+SoDQJoWe+Y9H2QNw6knrB9iC0SVrK5LgB9GKyKkO8R6+T1FDpTBepdHeRP5 vvrGDIt7rIci7wm51pSlE1963+HbG8/lq0OrxtoBDFszfiGLBwPftDErSMfGhGkmAJFiE0jOOZ7 GxEvwEec4Nubj5KFSN9DCTpbpzWjsHQrDHllUOAGUg== X-Google-Smtp-Source: AGHT+IHES3X7bBWKefrRx5Oeq3+fwih/9sYwDHjUiBu8Ltn1EI28OVr5N1sfMejLxo7ItO548TkrbA== X-Received: by 2002:a05:6a00:2d90:b0:736:3449:f8ee with SMTP id d2e1a72fcca58-7390593b7e7mr11684780b3a.4.1742695797897; Sat, 22 Mar 2025 19:09:57 -0700 (PDT) Received: from google.com ([2601:647:5600:80d0::31cd]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73905fd5639sm4998505b3a.53.2025.03.22.19.09.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Mar 2025 19:09:57 -0700 (PDT) Date: Sat, 22 Mar 2025 19:09:55 -0700 From: Noah Misch To: Andres Freund Cc: Antonin Houska , pgsql-hackers@postgresql.org, Thomas Munro , Heikki Linnakangas , Robert Haas , Jakub Wartak , Jelte Fennema-Nio Subject: Re: AIO v2.5 Message-ID: <20250323020955.e9.nmisch@google.com> References: <20250311194108.c5.nmisch@google.com> <5dzyoduxlvfg55oqtjyjehez5uoq6hnwgzor4kkybkfdgkj7ag@rbi4gsmzaczk> <20250312035743.f5.nmisch@google.com> <4b3f32ug3cayekysqlgspz2qjmeb7lca3gvazayglxr2m3d4dv@il33accgsji7> <17906.1741863183@localhost> <3yxd5r23zly5bytvgyktbxtxq2r3gbpi7xd4dugevh3h4w4q6c@lu6oatjjpltz> <6ak556uyqiptdwjaci4kbi5eykwkmzqgkbtkyaosjnopjhncrc@2v4ac2jwyz22> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6ak556uyqiptdwjaci4kbi5eykwkmzqgkbtkyaosjnopjhncrc@2v4ac2jwyz22> 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 Thu, Mar 20, 2025 at 09:58:37PM -0400, Andres Freund wrote: > Attached v2.11 > Subject: [PATCH v2.11 05/27] aio: Add io_method=io_uring Apart from some isolated cosmetic points, this is ready to commit: > + ereport(ERROR, > + errcode(err), > + errmsg("io_uring_queue_init failed: %m"), > + hint != NULL ? errhint("%s", hint) : 0); https://www.postgresql.org/docs/current/error-style-guide.html gives the example: BAD: open() failed: %m BETTER: could not open file %s: %m Hence, this errmsg should change, perhaps to: "could not setup io_uring queues: %m". > + pgaio_debug_io(DEBUG3, ioh, > + "wait_one io_gen: %llu, ref_gen: %llu, cycle %d", > + (long long unsigned) ref_generation, > + (long long unsigned) ioh->generation, In the message string, io_gen appears before ref_gen. In the subsequent args, the order is swapped relative to the message string. > --- a/src/backend/utils/activity/wait_event_names.txt > +++ b/src/backend/utils/activity/wait_event_names.txt > @@ -192,6 +192,8 @@ ABI_compatibility: > > Section: ClassName - WaitEventIO > > +AIO_IO_URING_SUBMIT "Waiting for IO submission via io_uring." > +AIO_IO_URING_COMPLETION "Waiting for IO completion via io_uring." > AIO_IO_COMPLETION "Waiting for IO completion." I'm wondering if there's an opportunity to enrich the last two wait event names and/or descriptions. The current descriptions suggest to me more similarity than is actually there. Inputs to the decision: - AIO_IO_COMPLETION waits for an IO in PGAIO_HS_DEFINED, PGAIO_HS_STAGED, or PGAIO_HS_COMPLETED_IO to reach PGAIO_HS_COMPLETED_SHARED. The three starting states are the states where some other backend owns the next action, so the current backend can only wait to be signaled. - AIO_IO_URING_COMPLETION waits for the kernel to do enough so we can move from PGAIO_HS_SUBMITTED to PGAIO_HS_COMPLETED_IO. Possible names and descriptions, based on PgAioHandleState enum names and comments: AIO_IO_URING_COMPLETED_IO "Waiting for IO result via io_uring." AIO_COMPLETED_SHARED "Waiting for IO shared completion callback." If "shared completion callback" is too internals-focused, perhaps this: AIO_IO_URING_COMPLETED_IO "Waiting for IO result via io_uring." AIO_COMPLETED_SHARED "Waiting for IO completion to update shared memory." > --- a/doc/src/sgml/config.sgml > +++ b/doc/src/sgml/config.sgml > @@ -2710,6 +2710,12 @@ include_dir 'conf.d' > worker (execute asynchronous I/O using worker processes) > > > + > + > + io_uring (execute asynchronous I/O using > + io_uring, if available) I feel the "if available" doesn't quite fit, since we'll fail if unavailable. Maybe just "(execute asynchronous I/O using Linux io_uring)" with "Linux" there to reduce surprise on other platforms. > Subject: [PATCH v2.11 06/27] aio: Implement support for reads in smgr/md/fd (Still reviewing this one.)