Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1211692lqo; Fri, 17 May 2024 14:39:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVsi63ZioCLYwYhEuvr2zxhWGv7buLJ4ysNO4aRUYqRi/frhZTziaDaZNoaPC3W+fvVz4u9tPrGUJlvt8/6vO+9ogNhviduyysCv1BEXg== X-Google-Smtp-Source: AGHT+IGXHV2G4uwq/7i9rNDP73dty0uQm2uqCENTMvR9Mn3Q8/+tVFACmo7IvS+Uvdp90KCkU7on X-Received: by 2002:a05:6e02:19cc:b0:36c:7bdb:c85c with SMTP id e9e14a558f8ab-36cc144e951mr295351055ab.10.1715981985843; Fri, 17 May 2024 14:39:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715981985; cv=pass; d=google.com; s=arc-20160816; b=wH3Grmc8rybnFPcFYjW/ETZyuOhp4/75qXD427yMje2eNPKDEODWhodeKCpE5Txx/5 G8tSw49TT5w9/90311nFt6Jo5sYeii/IxDRMD5hUrYPDxlGiPKls0eSwzhOcZHJOJJbn wPM3K+Uj07wHNQAJq2OorDzyhD9if9wR9Vb54cu+RgPgAWNtqhwxZnEnXM1s/cU1dvb6 PR2I4UDAckJcMCnfOQwprXwn1EF6cud2knwPTsnLA9AgTncsscyIN45CFPqihNmF/T1F COXcSJ3MqnRaArdvVmcCyGeboNIgH7wWD4U98nrBOrnCs/Em026QyNDQr1p+zKUWj4od fGkQ== 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:to:dkim-signature :dkim-signature:from; bh=DXtrA5LLFohLOjGP/edadyudWrEZRBECLedxJJ0rcYI=; fh=qjDezo9vaQ5m1N/atvey9CNr7tz3j4GqssRLHeg3PrE=; b=l88Vi1t+bcjMcnVAyPCMEuGirHQ2Cpa61UALJgLh/xztL41aPtSZ755WcxdpzCafxt oFWViwYpBYiEYdNKvf+XsxbNzAkBsZbG0qhX11SdkG4uR7e2w5aqe+V19L/PfKgy1tLN RKnLQ9+PYMyUcucdJSYZ9d5GiT5rRX7OeWzHbOJW02ZgEyBsE4rClGPb02e9/CdT/vgq gOuDXFuQOw/c8/0ouJ4XvTgNklpGgMS9rFb7bJvplM2xwVdfvp0slqrDsbOBArKhyIZL w/3p1Q7LwsmOmV27yVIF44z4yvD2nx+MziWgKJ54s+hbb3WL0IkUNJrzJ9J7RK9+6sTB TUbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pbL1P25V; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=ljOPtLVG; 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-182652-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182652-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-662aeb8d3besi726121a12.699.2024.05.17.14.39.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 14:39:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182652-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pbL1P25V; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=ljOPtLVG; 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-182652-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182652-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A958C285E6C for ; Fri, 17 May 2024 21:39:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0F3C142E6D; Fri, 17 May 2024 21:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pbL1P25V"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ljOPtLVG" 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 457D11419AA; Fri, 17 May 2024 21:37:59 +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=1715981881; cv=none; b=rQQxlzVFP9ZL8PMBBCgeCervdEkwt7mp38FZRKOZW5gHChbkpK/WzZYLwWhhRvjJFxGausybQEAInqbHc+6LBQpxz5McnMKWO5IWfhmT/DBCT7U+9UGqJkq0lh4ZVBzsHA3Owkmq9XnlwYjlhjOUWRTPi3JTB+J2teKZjX2VrLY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715981881; c=relaxed/simple; bh=O59K4hbDSsfiQU0mSa0j9lbI6l1M9YPmNCHJAuUsARc=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=IXOaKBCKpx+vuMd+F9Cw6tGll//1OW+GrZJVhaw28BVziC+JqwESaRjTMv/eIFn+CMU6JRmvGRlOfEiJ6sMB1A5GcZT9p6V0mAjpnJiFyozHySX/B+Nql++uSU3Q4ccC/jsVJzNiBGYKQ/AHWGmDgfF2rRAQAIciQbxilW1g0MU= 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=pbL1P25V; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ljOPtLVG; 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=1715981878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DXtrA5LLFohLOjGP/edadyudWrEZRBECLedxJJ0rcYI=; b=pbL1P25VT61HHZRS50rO5Gwpx0znpq5MQBGNgqKMYKYleyJZOtQx/eoVHjlw/zuCRaSnJC ULNr2b2vZQ7C8CJO34JuGGF5mWaWHGTOB2t2RNmso+xBL8Oo4zlEbAlXHkIMwS4hFtwlIz 2wdHQ3Wf3U5sCusbJzVXSrZnf+mQuntB6pjpF1nXhmp14eCOWy3OUCsyCOsLF0HUtsTcNI +E11XF1xFIS/0YWOW1JlCrgmm706qH6lj3GAIaEkqqEZhydbpekZh6nnAMxIuWVhc8WcFe dRco29ASa07t9RPrZ//V0G43K+YJ4zFOSZWBUnempkruDisMuCKTTuBP3LHF7w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1715981878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DXtrA5LLFohLOjGP/edadyudWrEZRBECLedxJJ0rcYI=; b=ljOPtLVGpxmk0jU3L4UqfG5IrEz0yayhXyrM3c/ZgIIHuhN+I+V36vHKQAxVndVuIuwDKX O1HriLIZJtakL3Bw== To: Costa Shulyupin , longman@redhat.com, pauld@redhat.com, juri.lelli@redhat.com, prarit@redhat.com, vschneid@redhat.com, Anna-Maria Behnsen , Frederic Weisbecker , Zefan Li , Tejun Heo , Johannes Weiner , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Petr Mladek , Andrew Morton , Masahiro Yamada , Randy Dunlap , Yoann Congal , "Gustavo A. R. Silva" , Nhat Pham , Costa Shulyupin , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v1 1/7] sched/isolation: Add infrastructure to adjust affinity for dynamic CPU isolation In-Reply-To: <20240516190437.3545310-2-costa.shul@redhat.com> References: <20240516190437.3545310-1-costa.shul@redhat.com> <20240516190437.3545310-2-costa.shul@redhat.com> Date: Fri, 17 May 2024 23:37:57 +0200 Message-ID: <877cfsjf0q.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, May 16 2024 at 22:04, Costa Shulyupin wrote: > Introduce infrastructure function housekeeping_update() to change > housekeeping_cpumask during runtime and adjust affinities of depended > subsystems. > > Affinity adjustments of subsystems follow in subsequent patches. > > Parent patch: > "sched/isolation: Exclude dynamically isolated CPUs from housekeeping masks" > https://lore.kernel.org/lkml/20240229021414.508972-2-longman@redhat.com/ > > Test example for cgroup2: > > cd /sys/fs/cgroup/ > echo +cpuset > cgroup.subtree_control > mkdir test > echo isolated > test/cpuset.cpus.partition > echo $isolate > test/cpuset.cpus This changelog is not telling me anything. Please see Documentation/process/ what changelogs should contain. > +/* > + * housekeeping_update - change housekeeping.cpumasks[type] and propagate the > + * change. > + * > + * Assuming cpuset_mutex is held in sched_partition_write or > + * cpuset_write_resmask. Locking cannot be assumed. lockdep_assert_held() is there to document and enforce such requirements. > + */ > +static int housekeeping_update(enum hk_type type, cpumask_var_t update) Please us 'struct cpumask *update' as it makes it clear what this is about. cpumask_var_t is a hack to make onstack and embedded cpumask and their allocated counterparts possible without #ifdeffery in the code. But any function which is not related to alloc/free of cpumask_var_t should simply use 'struct cpumask *' as argument type. > + housekeeping.flags |= BIT(type); The existing code uses WRITE_ONCE() probably for a reason. Why is that not longer required here? > static int __init housekeeping_setup(char *str, unsigned long flags) > { > cpumask_var_t non_housekeeping_mask, housekeeping_staging; > @@ -314,9 +347,12 @@ int housekeeping_exlude_isolcpus(const struct cpumask *isolcpus, unsigned long f > /* > * Reset housekeeping to bootup default > */ > - for_each_set_bit(type, &housekeeping_boot.flags, HK_TYPE_MAX) > - cpumask_copy(housekeeping.cpumasks[type], > - housekeeping_boot.cpumasks[type]); > + for_each_set_bit(type, &housekeeping_boot.flags, HK_TYPE_MAX) { > + int err = housekeeping_update(type, housekeeping_boot.cpumasks[type]); > + > + if (err) > + return err; > + } > > WRITE_ONCE(housekeeping.flags, housekeeping_boot.flags); > if (!housekeeping_boot.flags && > @@ -344,9 +380,11 @@ int housekeeping_exlude_isolcpus(const struct cpumask *isolcpus, unsigned long f > cpumask_andnot(tmp_mask, src_mask, isolcpus); > if (!cpumask_intersects(tmp_mask, cpu_online_mask)) > return -EINVAL; /* Invalid isolated CPUs */ > - cpumask_copy(housekeeping.cpumasks[type], tmp_mask); > + int err = housekeeping_update(type, tmp_mask); > + > + if (err) > + return err; Do we really need two places to define 'int err' or might it be possible to have one instance defined at function scope? Thanks, tglx