Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp39948lqc; Thu, 29 Feb 2024 09:42:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUE6pJsDC/1fVGS3KlO9PTWA3fXEDyZ95ctftFjPwn6sFJqPEqCkvRjF9C+aE/5D02r0Ec4VH3yotW24SPr6IpXL0Pf3gJiNJb/jFTXAQ== X-Google-Smtp-Source: AGHT+IG3EG267+zCWtt2pNwOfLCm2PBdRoKkDFwn5xVccnlTkf466qEcAItA/fq0B93sOoqpwbq3 X-Received: by 2002:a05:6402:2711:b0:566:ab90:1073 with SMTP id y17-20020a056402271100b00566ab901073mr1547857edd.34.1709228579077; Thu, 29 Feb 2024 09:42:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709228579; cv=pass; d=google.com; s=arc-20160816; b=fwm/YRq6afzAI/1dsEIMaqbrC0CXvsKcKFd9nQ6Qc654fzDEkflkRLQur4ZU0hquA1 4ClsuITK5ZhSmITQtgeceelXM91D2SjXIYSZvrWSvxyuMtIo2I1mlbLx6FYYodMkbyMF XnL33HvaL0XCtMPGmKgOdhzrFtxBYmCR3vtXzwvtxwZd6KtYZ69WfFp3XH9KA91hAFj+ dST0Ax2qEQkoo5z8lfNx2Cyn6Cd7yhh4ueQUIwghcQd/hx14gx8FjiGJI+CG8XrcMM7E qpN2WjEHaDXKj1qiTNaPXx5kaIWOsJxQvkwIQVXJNceLoNhaxF06WdM2V7t9rLTwfY0l 08wQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=ujeIxvSFSQUGbulyJ+o3KKiI0KcbSdZPdN9R9JucPJo=; fh=0kn0/WOXzw+3KaHaOUIhd1+Xb6AsrBBgeP+tZ8OaaUE=; b=zNp24jpH979QSI/Kavc7MPA+pYdJgdcMKwZSF8Z+mwaweUqdlvAU+XJiMVnTveJDBg COOpB1yL4a158+V1zwudVRq1CNF7lC6zAvVFo7yRfvswpTPEjhqZQqUll17PBZYT4Z1r XrJHzwe8KtncmEWRI67Dwox6K6QBkZ3ZZHU0G2pmHzUR8aoixRpFweJS3vTr1WG7AMrJ IBC9vml4F/x4SlmsFeZo9/mpy9it0+u23jZ0V1++tlKpTH05EK2r+xGtJ2N35tcksu9K xb+x/06ilC94cPr2OJVSL3b6IBUlWVvoixTMhNI0YcKGX2nRcUYwdFnM5cDCR61A5V2K Y+GQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LXfI4by3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=v0coO4Cc; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-87199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 8-20020a508e48000000b00566131a26e6si738672edx.345.2024.02.29.09.42.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 09:42:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LXfI4by3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=v0coO4Cc; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-87199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C67971F23A25 for ; Thu, 29 Feb 2024 17:42:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B263B70AF4; Thu, 29 Feb 2024 17:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LXfI4by3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="v0coO4Cc" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6439C1EB42 for ; Thu, 29 Feb 2024 17:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709228570; cv=none; b=BZwGvpOlYPIEaTq7EyFANuzojdIM1Dl6xoiaO9kWDQ+QjF+zbzz50JqfJJjxrxjB3qv45TxwWxfrO+go+/5GuVnMWX+PIj/3fOzhE2VLixdWLIwjEDODVGubpjxcWxQ7D5Scwe0Y9mq9rgXKrWI3sG/+uZ2k8zHinIhzVODuR7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709228570; c=relaxed/simple; bh=yeKcJOLy1njyemQ5Tl9jEyFRkzapZUSc5QRkXNW0P3I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=rUKD7s+tXOH0m4eVYajneVvJ+9wEYNBABoxB6kbzCjFz5+awiE635d7I9IfYZz18YTDyhWrPy6MpR6v3vlIsRO0W6fUmQUmsA0KbiXi8rit4EVgBRNE/ywtlyrxi7/pYeXTefRh7+Vwu36ou0P6jBzll5l/z551XZLZmsEGOOIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=LXfI4by3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=v0coO4Cc; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1709228567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ujeIxvSFSQUGbulyJ+o3KKiI0KcbSdZPdN9R9JucPJo=; b=LXfI4by30DHBqfzWPbBiAOTLrjn2XTgU6pqj8wmm4Qf1dmlUozdjKI34FuYSya+ZWXu1Uc CRZacPP+g3YZ1sJslQCYMjQgCdS4gGjFpR2tUlfXmmVrixdDIjMYW4e/fohyzeCeh4bNCe 4qJZn2473TiyibgeGTuTC1Igo7Sp75y5GuYwb7fnvWzFG51RnpwoJmY34CUu7fuptbuWDc o4lh9HTMT6Zno/+dso6ay1ovVeOXI7TNYR7HYJHyJo0eIDocFiT3Eadypb2mGbNwdddhYc SwXED+2nfQh/DzvxWAi4dp5yZGnuNRPUMRb7M0DE3x5SZOVobeBkCeykBubxHA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709228567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ujeIxvSFSQUGbulyJ+o3KKiI0KcbSdZPdN9R9JucPJo=; b=v0coO4Cc6NRk9gFWT+XAuUQG1TWdaTk1UBdmykYs+bTYlc250kZVyU9/YPYCpAl8/U+X85 zf6tTBPrt96/pcCg== To: Jens Axboe , linux-kernel@vger.kernel.org Cc: peterz@infradead.org, mingo@redhat.com Subject: Re: [PATCH 1/2] sched/core: switch struct rq->nr_iowait to a normal int In-Reply-To: References: <20240228192355.290114-1-axboe@kernel.dk> <20240228192355.290114-2-axboe@kernel.dk> <8734tb8b57.ffs@tglx> Date: Thu, 29 Feb 2024 18:42:47 +0100 Message-ID: <87wmqn6uaw.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, Feb 29 2024 at 10:19, Jens Axboe wrote: > On 2/29/24 9:53 AM, Thomas Gleixner wrote: >> On Wed, Feb 28 2024 at 12:16, Jens Axboe wrote: >>> In 3 of the 4 spots where we modify rq->nr_iowait we already hold the >> >> We modify something and hold locks? It's documented that changelogs >> should not impersonate code. It simply does not make any sense. > > Agree it doesn't read that well... It's meant to say that we already > hold the rq lock in 3 of the 4 spots, hence using atomic_inc/dec is > pointless for those cases. That and the 'we'. Write it neutral. The accounting of rq::nr_iowait is using an atomic_t but 3 out of 4 places hold runqueue lock already. .... So but I just noticed that there is actually an issue with this: > unsigned int nr_iowait_cpu(int cpu) > { > - return atomic_read(&cpu_rq(cpu)->nr_iowait); > + struct rq *rq = cpu_rq(cpu); > + > + return rq->nr_iowait - atomic_read(&rq->nr_iowait_remote); The access to rq->nr_iowait is not protected by the runqueue lock and therefore a data race when @cpu is not the current CPU. This needs to be properly annotated and explained why it does not matter. So s/Reviewed-by/Un-Reviewed-by/ Though thinking about it some more. Is this split a real benefit over always using the atomic? Do you have numbers to show? Thanks, tglx