Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp774038rwe; Fri, 14 Apr 2023 09:31:15 -0700 (PDT) X-Google-Smtp-Source: AKy350a+6vIKmxdepMO1BvQu3GI2ttOavF5gslmuR8fFkOGqem3z4K5H8TKxWWm2wks54iXEKwJq X-Received: by 2002:a05:6870:14cc:b0:178:e1f2:7f22 with SMTP id l12-20020a05687014cc00b00178e1f27f22mr4324360oab.30.1681489874695; Fri, 14 Apr 2023 09:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681489874; cv=none; d=google.com; s=arc-20160816; b=vrsrN6WSkBHDZgEbmAUmZ6wSkH6leadK9rWdKGiUnbkpMU2t80rsjXXKeDzxCbqJ7D 7So54QaD4VS0gSrdEpy53Maa2/O2uIQYUitDPrnI3F4xkKTE44NHCpODSnCE5nE9tzTe a80MPagI9uCtwZW4vP/hEUpRhiR0dtGGu1ROH4aylb7gKQHOJK2NgByCxZt+Yj3h1k7L SyeuV9IEgAnb0EamrbZ6jP7J0bOkohZkxJIj1vKj6fzNRdrLbNQU/RlfHNvLGwlr+WAU GFqHwZFgGq9aoH2jN0NR7lskVOLUg6ELkd/xbfuECEmpKnZqvV2L9t9BtQSK9Oe1v06I XNVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=c+unp6injjwLp32rDRhFKdS15pYib3N33LpCMho7UDw=; b=RCHIZNYi/qTilmld2nj4hKA6Ep6N7Z7wDAqGLLI41I69XFlF3pHm/CTr3F/665ZtN/ h2G5jRqZzipYQ9qdFWcKcWJ1BI9ExMn/0GoINezWlsDox3V9MtUfWfkWEg7nJJxmvyqB izFv3PbKV7GAH0zAv+C58v/YYWXcYXjgVzNmIsSEdFHuMJSPtAWQNSztZueJfF+//UO1 Xd7GGZzfeQgRQOeyKLlfYGt0+4XXUTcjwPh/UF2GzvGun49TjMdpQxIBJ8oqa0UNSOO1 DqiZbqjqd52GLvKGUvC8JVdpTinB8vys09IM9hPYuMXBnLbFJU0sZpUuOw6qxf4rPkLo OUfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=T8SDQEIl; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fq7-20020a0568710b0700b001878ab7c0e2si4519776oab.128.2023.04.14.09.30.56; Fri, 14 Apr 2023 09:31:14 -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=@linutronix.de header.s=2020 header.b=T8SDQEIl; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229579AbjDNQar (ORCPT + 99 others); Fri, 14 Apr 2023 12:30:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjDNQaq (ORCPT ); Fri, 14 Apr 2023 12:30:46 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 525398A62 for ; Fri, 14 Apr 2023 09:30:45 -0700 (PDT) Message-ID: <20230414162755.281993820@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681489843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=c+unp6injjwLp32rDRhFKdS15pYib3N33LpCMho7UDw=; b=T8SDQEIlUJAsUrnY50V68zec8cQsBn3NrlF9A9FDxDlkD22dBhjIx3mMXVQdg1VvSvrbFh 32+WnQIsXxLhEasQ0D2xSrGtMIRLeFc7Wm9qMDGcqifNCEj/We9F2QvsmsOLtDkjBHvazP FlT1ZGceUGsMOvbBDq8+0pb8yhzHlTEDLN9vTg2cJ2S6fb6Ddau6rxAyJaS8XXyvWA/oX7 OiOLI1s44qTn56vp0AMFdMkegqEIoIbPOqcoFRGSDoI24PDRlEcAyaqt3uJ5pV8jWVH+wE Ap5Pw61kRrU2Jvv4BJktNSSFDJJkLTCMs8KCNMjVQJXaJeQThzu8q1IiIg6vxg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681489843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=c+unp6injjwLp32rDRhFKdS15pYib3N33LpCMho7UDw=; b=tLLNUNn2IybA12zVsUJc/Wcbt3VorXkST75UUn9vq56G0ASHyaO6NmAx/tpBs4WP3+GVXe BZr11lVUYB0Yd5AQ== From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Valentin Schneider , Dennis Zhou , Tejun Heo , Christoph Lameter , Dave Chinner , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Ye Bin , linux-mm@kvack.org Subject: [patch 0/3] lib/percpu_counter, cpu/hotplug: Cure the cpu_dying_mask woes Date: Fri, 14 Apr 2023 18:30:42 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hi! The cpu_dying_mask is not only undocumented but also to some extent a misnomer. It's purpose is to capture the last direction of a cpu_up() or cpu_down() operation taking eventual rollback operations into account. cpu_dying mask is not really useful for general consumption. The cpu_dying_mask bits are sticky even after cpu_up() or cpu_down() completes. A recent fix to plug a race in the per CPU counter code picked cpu_dying_mask to cure it. Unfortunately this does not work as the author probably expected and the behaviour of cpu_dying_mask is not easy to change without breaking the only other and initial user, the scheduler. This series addresses this by: 1) Reworking the per CPU counter hotplug mechanism so the race is fully plugged without using cpu_dying_mask 2) Replacing the cpu_dying_mask logic with hotplug core internal state which is exposed to the scheduler with a properly documented function. The series is also available from git: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git smp/dying_mask Thanks tglx --- include/linux/cpuhotplug.h | 2 - include/linux/cpumask.h | 21 ---------------- kernel/cpu.c | 45 +++++++++++++++++++++++++++++------ kernel/sched/core.c | 4 +-- kernel/smpboot.h | 2 + lib/percpu_counter.c | 57 +++++++++++++++++++-------------------------- 6 files changed, 67 insertions(+), 64 deletions(-)