Message ID | 20240227211152.1099534-1-axboe@kernel.dk |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-84016-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2968022dyb; Tue, 27 Feb 2024 13:12:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUbXnJzvFi6za+2/TR8qGr62jhLWvaw8Xm5XXHAIGtFYjovrm3w7xqnD0ItvJQfd77X2iIb+R/vGMmuyq8jWqcyCLlEOA== X-Google-Smtp-Source: AGHT+IHNLUOzgJHD6TYOu7QHkDknlrPtMix+0XUy+DmcWlNShQ/Pgbjm2fnimP/ZQxeSanNja0kE X-Received: by 2002:a67:f313:0:b0:471:e03e:224c with SMTP id p19-20020a67f313000000b00471e03e224cmr7190899vsf.1.1709068344802; Tue, 27 Feb 2024 13:12:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709068344; cv=pass; d=google.com; s=arc-20160816; b=ZVRgmy2HoEFoTlgL/U8toLZu23JziRVRGSVBYZDGajtar9a0meDbYJLnqOb4VIWg08 VjnsiADYmAB/hv68AY+hWmlnpGeenPaOBNHjsU6g1N/wOlWNPznFbatG/EkT/zW5SSTs ysaOatZ1EvhBH8+6UuNo/4Hvgp+CNwneFHKm4JLLclPN1Pf8znWGgt9U0Nqd3IcG1sVw JRi962Xn7OMAYcEHptD5528Vz7w4xry4Ys8Wv6rPVF/kdgSCV0f+Go/kXzGji+MX1e6t Qw/jY6Oc24vq/VnIz+lBkh23PRq3iDXqfMN07i6zIM61RQhjsn7AHFgNIhH5UIgYlpPl oA9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ZPE+oqeP/gO+8e/ieSDDfq6bOx9XZ+PWeSTcgAFWM9g=; fh=Wqt4u592Vc0Ekdwkaff3R7fCAv5OiPLKw9u+HiUQN2w=; b=X52Qb45rOnjTKgpyfTl4I4iDDx50Gu9xZgq3khv3TPYyWUHo0FbuRGa0X6U82ZPM4l fdWMi8b2SkQi9CtYGzz4IUwxkkUxf0zgo38UVd0797tYO1dxFlBpf+W8wly9Bf4kbSiw Y50RxnOIjISJIcrTvbSWBy4x8Dt6BnBiXCNcOvl8HnTPUM1J/pNbXZToETSxs9qb9RyG GjWgXsYrBQ53pk5qWAtVTiiH7TWza8ljToiHNW66DqPf5A68d2T23zEezTXplJSw81jh FPqncKG/9fi/cFSLLImrZBnfkXP8rauIBoppQSnOxdYI7gqSL+uMIOIVLzw0KeqvPgYx i5JQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=CEEvFTez; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-84016-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84016-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h9-20020ac87d49000000b0042dc7d56c01si9235358qtb.60.2024.02.27.13.12.24 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:12:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84016-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=CEEvFTez; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-84016-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84016-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 96D0F1C24034 for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 21:12:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CCD614F99E; Tue, 27 Feb 2024 21:12:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="CEEvFTez" Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (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 4B8D014EFDF for <linux-kernel@vger.kernel.org>; Tue, 27 Feb 2024 21:11:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709068321; cv=none; b=TVgkzTsmIefMiO0wkfu+s/enpIaFw8P2ihJImszhkSIMR0JpZPGs9sFzEbvxO6hSKOh/nmgEWngvaiRsXdRqS/1tp1lc/PuX3G+5riUbM4NAHUFZx4UxjlMfdmbkKhuCVQaLzbN2iSrRFmJo4F0Y3PR5ykve5CtLlNE44b6T4u4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709068321; c=relaxed/simple; bh=hEk9QDFeu1YKNa8wvXHA4VBVHU0myYC6K9alzCsgJxs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=omOqh7DtWnaHUsL8p3oAjchMZyd7BFhWGli04K9ERyMERSG7/Kw7kg1O9KnJa1FogUd4FU/9yzhBsHOmZtmFXu31+DMZ7dGwf+r0rCMt33VtvgAZRNEzfPmftRTjwR1LtH18xJEsfLjsFxj9GV97t345xLUksNqcj5mVUmZ+gfw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=CEEvFTez; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-55b5a37acb6so1830143a12.0 for <linux-kernel@vger.kernel.org>; Tue, 27 Feb 2024 13:11:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1709068317; x=1709673117; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZPE+oqeP/gO+8e/ieSDDfq6bOx9XZ+PWeSTcgAFWM9g=; b=CEEvFTezO13TATFk+aNsE9vWHxszrx/0ND8oGCoz2z6r9nc7o6Pd6Gdne8DKG9Dlzz +oBsOI8r45glX0rJqQ9CJ7CAhdlEFCWpEl7JGVMWu09xk082A+shih1KGHiu5NrOp+4g NBS7F4gEqEvvuWio0hMJjdm0pXGG2CNQlrtXTV9u6lfwpsUM3svkcsegx0mHZwrAkjBZ B6tYSWmFKFc8cu8hGrtWllfACxwJEw96btujcJs2DJqkK8TxDYrj8xlDI5QQGmDRZ8YU e0Mt6j03vfBE+hmHfvjMPTZaA+gbG88G/aiZkv1D47zPQ7PxetRWlHJb+iRIxNpeFl00 msiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709068317; x=1709673117; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZPE+oqeP/gO+8e/ieSDDfq6bOx9XZ+PWeSTcgAFWM9g=; b=EoAxd4CWaaL87oMK3jfTQGpz9VEO8Uz12DcXwif8pJV0o48jqzcIZI+mH/fPh8IVKV fLPWqGYFwzzy6I38QdCEA+Yg9q4g/s0Zs2xXD3b3/hG2bADqgCFUlMq3AXX/1AAdW0MX Syw8hZOwjCQ6ZArvrDTxgANPifMh9sf67/1Ro1aAt+g1/gpdfe9gjBTwNxuwUbvJ7zk+ oxt2VS62S8lSFsZFxgPDAQEZ4ZKeNIrDVkJmcIL/MSbEFA6qgquD+PwjfH0y9VX/j6kZ dsXVHn/GOijy0QSL8IZj+wbTxD5+9Fh1s7IogPZrWyU2gtPHp0WVLqGRY5Z+16trXdFV 0FGg== X-Gm-Message-State: AOJu0YzXvgmJaH8RyTl+6gqZmbrHDNRabghqycfBG2tOUsmG4gblA8s7 O/dQM18CXyyeutSmRbHYp7cwfdkzWtBD+FtxTIjywO9OjuQe/QyD7YrWgQy0pRAmwItV/DVmHSp T X-Received: by 2002:a05:6a00:1384:b0:6e5:4abe:fd4c with SMTP id t4-20020a056a00138400b006e54abefd4cmr2833451pfg.3.1709068316753; Tue, 27 Feb 2024 13:11:56 -0800 (PST) Received: from localhost.localdomain ([198.8.77.194]) by smtp.gmail.com with ESMTPSA id u8-20020a056a00098800b006e5557128efsm735390pfg.133.2024.02.27.13.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:11:56 -0800 (PST) From: Jens Axboe <axboe@kernel.dk> To: linux-kernel@vger.kernel.org Cc: peterz@infradead.org, mingo@redhat.com Subject: [PATCHSET v2 0/2] Split iowait into two states Date: Tue, 27 Feb 2024 14:06:01 -0700 Message-ID: <20240227211152.1099534-1-axboe@kernel.dk> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792088048450197088 X-GMAIL-MSGID: 1792088048450197088 |
Series |
Split iowait into two states
|
|
Message
Jens Axboe
Feb. 27, 2024, 9:06 p.m. UTC
Hi, This is v2 of the patch posted yesterday, where the current in_iowait state is split into two parts: 1) The "task is sleeping waiting on IO", and would like cpufreq goodness in terms of sleep and wakeup latencies. 2) The above, and also accounted as such in the iowait stats. The current ->in_iowait covers both, with this series we have ->in_iowait for step 1 above, and ->in_iowait_acct for step 2. You cannot be ->in_iowait_acct without also having ->in_iowait set. Patch 1 is a prep patch, that turns rq->nr_iowait into an unsigned int rather than an atomic_t. Reasons given in that patch. Patch 2 adds the ->in_iowait_acct stage inside the current ->in_iowait setting. I haven't been able to properly benchmark patch 1, as the atomics are noise in any workloads that approximate normality. I can certainly concoct a synthetic test case if folks are interested. My gut says that we're trading 3 fast path atomics for none, and with the 4th case _probably_ being way less likely. There we grab the rq lock. Comments welcome! Peter, CC'ing you since I did in the previous, feel free to ignore. Since v1: - Add prep patch 1, switching nr_iowait to an unsigned int - Modify patch 2 to not use atomic_t as well, no changes otherwise arch/s390/appldata/appldata_base.c | 2 +- arch/s390/appldata/appldata_os.c | 2 +- fs/proc/stat.c | 2 +- include/linux/sched.h | 6 ++++ include/linux/sched/stat.h | 10 ++++-- kernel/sched/core.c | 55 +++++++++++++++++++++++------- kernel/sched/cputime.c | 2 +- kernel/sched/sched.h | 3 +- kernel/time/tick-sched.c | 6 ++-- 9 files changed, 66 insertions(+), 22 deletions(-)
Comments
On 2/27/24 2:06 PM, Jens Axboe wrote: > I haven't been able to properly benchmark patch 1, as the atomics are > noise in any workloads that approximate normality. I can certainly > concoct a synthetic test case if folks are interested. My gut says that > we're trading 3 fast path atomics for none, and with the 4th case > _probably_ being way less likely. There we grab the rq lock. OK, so on Chris's suggestion, I tried his schbench to exercise the scheduling side. It's very futex intensive, so I hacked up futex to set iowait state when sleeping. I also added simple accounting to that path so I knew how many times it ran. A run of: /schbench -m 60 -t 10 -p 8 on a 2 socket Intel(R) Xeon(R) Platinum 8458P with 176 threads, there's no regression in performance and try_to_wake_up() locking the rq of the task being scheduled in from another CPU doesn't seem to register much. On the previous run, I saw 2.21% there and now it's 2.36%. But it was also a better performing run, which may have lead to the increase. Each run takes 30 seconds, and during that time I see around 290-310M hits of that path, or about ~10M/sec. Without modifying futex to use iowait, we obviously rarely hit it. About 200 times for a run, which makes sense as we're not really doing IO. Anyway, just some data on this. If I leave the futex/pipe iowait in and run the same test, I see no discernable difference in profiles. In fact, the highest cost across the tests is bringing in the task->in_iowait cacheline.