Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3336342rwo; Mon, 24 Jul 2023 09:29:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFPx3dphMp1vaK2WNrcnNoeKlmFriBTQBNnLAVZVFFb1xgNtqnkH51EzfI03zPO12S6DpX5 X-Received: by 2002:a05:6512:2109:b0:4f8:5af4:73f1 with SMTP id q9-20020a056512210900b004f85af473f1mr4999360lfr.32.1690216185288; Mon, 24 Jul 2023 09:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690216185; cv=none; d=google.com; s=arc-20160816; b=B4dGr8skrUj6ZqeAUm6m56HoW2X8boAKKJk5uDcW8AA/8wo+8L0w/nompp6MfoWHak QgAaldw21EL8jRfnPXLX1q4TZsMoH8cLfYNDCVHJh5VxiSX9mBfLTNy8IH7Mzp82/mEf CKRtYJ4ylxeysSGr613kZr5sFzHz5b8Mekwx+iz9SZY8GfBeXLBZUigY3fYsM1hJMAzq 0FQr07Yf8lc2QIMvIYKT/QlLF5E8PhA+9DvcDVDGMF7LIlcEYBvM45Se2oPIb9aBCEYm aS2WfNI9lur2+uhfAZ5HIaTLTyLJgS1FssoQewG28m3RSSbuDN/t4xUN8oxh4wQ68fRK 8nnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=H+9hATyxM1wFvDyiZv4CUg26TjbnT4RKHY7Z6xDG7Qc=; fh=6UugmdPjpmk3lRwbzxh6PHFP1JI9B+K2q+t0cjtLB1E=; b=NhUwhlbA/tJt7itbIVw1U5Yroa2YCkGPfCTdyac00jbez4u0fuOy09bSjnunYUAysi WK0J2hqY6GERvWq7gPzT82DiYltY+IKjHHMRkkqB4Vq+uLsRMoJvSXCXsw7dBVrjI+ca 0Nqzt6i30FImTN2rC3uHxpBKDjbE3IOfK+he2nMuDEeCQef3bPQm/0CEsZJIuuLvB0u8 9jFCRUT7ewFyUgXCdCCCf09vLjnMfbnAYh/S58hBtfP092q4FYPVj0tj0HZ7P1vTWQlD UjuAY8Ck04OTWCTbaWXB73HjkKQ5BmqbZNOIwExbQvkF7QysvYyVJtlN12kWtiMvx8G2 6faw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=n4RguLbi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=raspberrypi.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020aa7d410000000b005223eaf48a2si310632edq.268.2023.07.24.09.29.20; Mon, 24 Jul 2023 09:29:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=n4RguLbi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=raspberrypi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231253AbjGXQHY (ORCPT + 99 others); Mon, 24 Jul 2023 12:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230351AbjGXQHV (ORCPT ); Mon, 24 Jul 2023 12:07:21 -0400 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F83410F4 for ; Mon, 24 Jul 2023 09:07:16 -0700 (PDT) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-583f837054eso14656277b3.3 for ; Mon, 24 Jul 2023 09:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1690214835; x=1690819635; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=H+9hATyxM1wFvDyiZv4CUg26TjbnT4RKHY7Z6xDG7Qc=; b=n4RguLbipIDQE05X2UsocctdpugWflo7O4z8c3gwAfkLynyr8zm5/CVjbVs+tll8O7 X0Ku/7bnlehb3Ox7SBdt1JsBF51lWhN9JK4rkJEMe0mtYfMYNmhReGcTwTaGi7XrgH6w AoqM98jUDwcsem/XlkeUawhQ/Quf5wkpYquBpA2iv6vMPHpiz/M0Efuv1r/EidPG0Cga g/AtYUJgSPRocmaMMJ5LbLxrodle3GBgnj/TYbtq4vGuFmT/0T6ZBnSct+p5l8T3d8J5 iuyr8NvNhfPPNd6gvWBkWI3g9QTKs7q2xbyLTIMfzVy1BOOaCmxvRzGuXAOkGFLAzt4f aGVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690214835; x=1690819635; 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=H+9hATyxM1wFvDyiZv4CUg26TjbnT4RKHY7Z6xDG7Qc=; b=Q7UDu6vU92va0vtGi6ghi9d7SQrPS0p6o3k/05xUryMYlHHQ27CjGHV98jUXtcFH7f cPRia5D98Lz3VySlA27NYaMJwEt1X1eHhuOwdSN3HZf4VOGluYR7H4V20IxXF0yNOkRV 9LB6VGrBbAAR3XL/t7WJADrxN8aXhLzmeUrDUYXw8daML8gE/OW6DE6/0d5+x46A3HP/ mJ8lE5nbXJFfkJL3YOyB75WMa374y1q/u60DQvyp9RyTWD5rJPa1fYTYNzJtdfsqPabk Yh7EtKiLwboefkS1cKHdI47ZRtTI9J0xtl6HvP8wfS+iz8ZaRsn1NtVZ40s0FjgKkO2O NWDQ== X-Gm-Message-State: ABy/qLYO/D5euiJzi9BFzTTrQEF4JqonEGZ7500SYiH/0ODwPdaF8yUi x2XspnmRyTHY22mruk7NFpjzuKkiEBsl2xwloKCQLA== X-Received: by 2002:a25:ada1:0:b0:d0f:2038:9ca2 with SMTP id z33-20020a25ada1000000b00d0f20389ca2mr3639883ybi.51.1690214835437; Mon, 24 Jul 2023 09:07:15 -0700 (PDT) MIME-Version: 1.0 References: <2023072438-aftermath-fracture-3dff@gregkh> <140065e3-0368-0b5d-8a0d-afe49b741ad2@kernel.dk> In-Reply-To: From: Phil Elwell Date: Mon, 24 Jul 2023 17:07:04 +0100 Message-ID: Subject: Re: [PATCH] io_uring: Use io_schedule* in cqring wait To: Jens Axboe Cc: Greg KH , andres@anarazel.de, asml.silence@gmail.com, david@fromorbit.com, hch@lst.de, io-uring@vger.kernel.org, LKML , linux-xfs@vger.kernel.org, stable Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jens, Greg, On Mon, 24 Jul 2023 at 16:58, Jens Axboe wrote: > > On 7/24/23 9:50?AM, Jens Axboe wrote: > > On 7/24/23 9:48?AM, Greg KH wrote: > >> On Mon, Jul 24, 2023 at 04:35:43PM +0100, Phil Elwell wrote: > >>> Hi Andres, > >>> > >>> With this commit applied to the 6.1 and later kernels (others not > >>> tested) the iowait time ("wa" field in top) in an ARM64 build running > >>> on a 4 core CPU (a Raspberry Pi 4 B) increases to 25%, as if one core > >>> is permanently blocked on I/O. The change can be observed after > >>> installing mariadb-server (no configuration or use is required). After > >>> reverting just this commit, "wa" drops to zero again. > >> > >> This has been discussed already: > >> https://lore.kernel.org/r/12251678.O9o76ZdvQC@natalenko.name Sorry - a brief search failed to find that. > >> It's not a bug, mariadb does have pending I/O, so the report is correct, > >> but the CPU isn't blocked at all. > > > > Indeed - only thing I can think of is perhaps mariadb is having a > > separate thread waiting on the ring in perpetuity, regardless of whether > > or not it currently has IO. > > > > But yes, this is very much ado about nothing... > > Current -git and having mariadb idle: > > Average: CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle > Average: all 0.00 0.00 0.04 12.47 0.04 0.00 0.00 0.00 0.00 87.44 > Average: 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 > Average: 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 > Average: 2 0.00 0.00 0.00 0.00 0.33 0.00 0.00 0.00 0.00 99.67 > Average: 3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 > Average: 4 0.00 0.00 0.33 0.00 0.00 0.00 0.00 0.00 0.00 99.67 > Average: 5 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 > Average: 6 0.00 0.00 0.00 100.00 0.00 0.00 0.00 0.00 0.00 0.00 > Average: 7 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 > > which is showing 100% iowait on one cpu, as mariadb has a thread waiting > on IO. That is obviously a valid use case, if you split submission and > completion into separate threads. Then you have the latter just always > waiting on something to process. > > With the suggested patch, we do eliminate that case and the iowait on > that task is gone. Here's current -git with the patch and mariadb also > running: > > 09:53:49 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle > 09:53:50 AM all 0.00 0.00 0.00 0.00 0.00 0.75 0.00 0.00 0.00 99.25 > 09:53:50 AM 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 > 09:53:50 AM 1 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 99.00 > 09:53:50 AM 2 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 99.00 > 09:53:50 AM 3 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 99.00 > 09:53:50 AM 4 0.00 0.00 0.00 0.00 0.00 0.99 0.00 0.00 0.00 99.01 > 09:53:50 AM 5 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 99.00 > 09:53:50 AM 6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 > 09:53:50 AM 7 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 99.00 > > > Even though I don't think this is an actual problem, it is a bit > confusing that you get 100% iowait while waiting without having IO > pending. So I do think the suggested patch is probably worthwhile > pursuing. I'll post it and hopefully have Andres test it too, if he's > available. If you CC me I'll happily test it for you. Thanks, Phil > -- > Jens Axboe >