Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp967209rdb; Fri, 2 Feb 2024 09:13:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGO5SwMAIQOFWY1y/EcYktbrGQW5Xbq12g8VuB5x9BCehcNtwD+IyW2l3EsfOYnADMfIgdx X-Received: by 2002:a17:902:e88f:b0:1d9:30d4:8a7e with SMTP id w15-20020a170902e88f00b001d930d48a7emr9852611plg.9.1706893988747; Fri, 02 Feb 2024 09:13:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706893988; cv=pass; d=google.com; s=arc-20160816; b=XZf8zrZeo0vSUYeV4Tp8Seb78KOX86YYI05Mtay+cUK6yvv6qG4X6jUtfJOHrFW95z 4GVj7q11tZ1tG1qrsdjdcmJblLhMZjYzGGUJgweatyY9mecW6ieguQ8OJVfzotCRH0i0 FFOxYsO/r/hzuAzZbGK8ierjn3zyjSSwFuU4IGTvT39zwmSgvHlMujnTUFNarR6FS3ka ZNNKmOhU7LpxxFL1Zj8B+Oc67gRYPpjFfteSp8+0iUqRzld4YN3az+fjWR6Q2oO6tolc pDEcO+toOWelQXZl7M13MdStXDS+BIrBPTDxCrzE5B7ZnrnN4YK3iCOWDCXojRxsY6nv 0YCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=KXiHcGm/fEWJbHkucFqY9QtCWzZf+8tRbfnCNBla688=; fh=U5/ZI9qKA+G7J5v99/DK3bS9jQ6wyK7bRkEvJyAzvi4=; b=tHBKevEBndkc1rffzdI7kyexaZYeR332rSIDp4Scx+umTWq5PsDyLejg7q5dPKGRN4 OaeGYZ0Bqu3jU/fbScPwCmbLZLi70Axl8JdeOnWEpx0JqvHr3GfRmhEkPozZYVNGf2Kb Be31Rg0k8oRc1Dav2h/gqXw5aV0PJLEMiChW4J1PUj07t9nnO5/PuZXhXkpv4Z9LFWb1 78XsfF8qmmrVWOLzKbirHhKbKvGFROgYh+0ic/Hc4FlByXGWIs6RTA3ARTbkpdw01p0K 0WAI1uIYQZbl1jbbk4VpXzzYSv4L4M6gQ2oDUktbtHpioSbOj6W8RzfZKiyMW9XsCBv2 BdPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=c8zpX9Xs; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-50209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVr/pLehtNY2JIgG/2vYQ2CezEU5c0tJO6ZKKDNTDlWosXVIxYUljHVrZ4Xhm0chnJAQSdfFPlnTHBHob8PhiTe6aU028An4kREfHQ8BQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j18-20020a170902da9200b001d8edfec672si2045952plx.405.2024.02.02.09.13.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 09:13:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=c8zpX9Xs; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-50209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 28A5C291B90 for ; Fri, 2 Feb 2024 17:09:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B87C148FFA; Fri, 2 Feb 2024 17:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c8zpX9Xs" Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 632CA7CF04 for ; Fri, 2 Feb 2024 17:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706893663; cv=none; b=q72gwt/0nrhMhsLRKQMlC6J2l5sYd1kyxfJPDrqTyVq5vOOyAtQNUJH8hCyzvpa7lXnrkCV15cNZmdsVOK53CZoD9v8VUqX7T2ZH/bpFTl46AZHAVle7MKIPuLJzbF7G1nFqYyuSSnuTr93e2bPSM5WDqgKfS+zFnGtCDrRWhI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706893663; c=relaxed/simple; bh=c4RcPMFX8/n1fPS/BEjIz5l09Pf1Qh+kPRau7pkLQ30=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=i0hfUrGJWJA4pqQ8gibenMdj4Ml/+SPBVFXST+bAmZqVTs6NNIDKK24oPQz/mavY/qLgpqFn0YSEUvjeW7Q0fHtqwbn0e5ffnvE5azgZlTDCIrsyRHSyk3cPR6Ao5Z7e37qxuQRUO0qHO0nO7vaqwLPDXckDZTSXdDANY8uRYX0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=c8zpX9Xs; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d932f6ccfaso18695595ad.1 for ; Fri, 02 Feb 2024 09:07:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706893661; x=1707498461; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=KXiHcGm/fEWJbHkucFqY9QtCWzZf+8tRbfnCNBla688=; b=c8zpX9Xs/tCs4oTL1KMhDJ9gJjrbECzHT971OMJa+HsBK8TEmd41vHHnAqvxryWKnc ilpGK2XVqKr5IOVdw/iu23W9Yd+hjRGPwlwEFMMkoSmCA/ASoKFe9C27XQkQCXcD6PdY v9OhnqAr3WvcDNl8S4uByXylrTZPOCez6pf0X41AnX/nqxuJbK3nw6zXOoL8ZkwTORQS LJiD8eV/twC31HndQL3asvLyb6TH6R/II0gNXQa3hemwoSnOT9SLflivwxWWyPu9Gk2y ZratI2fkY5JNREZT4lKvI1qHs1LA6TYad9F6pmNjGhJl83KDM7twNqKCYOEF9TnsUrwt p71w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706893661; x=1707498461; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KXiHcGm/fEWJbHkucFqY9QtCWzZf+8tRbfnCNBla688=; b=DFhmM0gZmQYFM+/QHzSlvrRS4sxM8YQbIF451ozIGv2hZvftJyDRLlRFkgtWgV6bJX ukULAb4jadWiU4ongk+O1Kwwy3kQJP3kwmQADwWu8qF9tbTF1nQBCb8khvMJN/3ai/Xn 5GRKLzBv7xibsoK6hUH1e0aRPV49rJf/OZj9UCmyZC+XVyy6SHbjDON///W0CBi6pH2e pvPki6o2AxzowL1BNVFV2d57ma+lK+q/rnMZ5UG+ftVMAZshMBHs9PEODUKMASwvPT3v w1FR3bEZdlD3TXENQPDbkfVy6aplsrvW6ELWIRSd4ZOAhtp3SBnTz6k0qd/ooynyRS80 /WzA== X-Gm-Message-State: AOJu0YxrmpmrOXWcWsHRRTo9w281Xlb3udkEmK9FeNc/KTrQii4XysRV I+zISD+wAM/xI/ztv++MrggYoeEawQ/poC30X+YPd/9xXJQAIVrXhA03D1HLrVA= X-Received: by 2002:a17:903:1d2:b0:1d8:fe1e:7cb9 with SMTP id e18-20020a17090301d200b001d8fe1e7cb9mr11129366plh.19.1706893661549; Fri, 02 Feb 2024 09:07:41 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVfv6SYCKtmQaa9wAyQLbdqRRfAfnjsFSqxPLTWpoO8Tlz5ZpOTxNLSdLbpFrD/kFeLP7X137J6gdCoRof9gzIDDmmpss0/GcV3G21l+mgs79V9v5MFuioKmKOjvI7O6XMIymqK5vLU2sSGiEppOMHpAi7Ix+vnPhbRoAjECNxh0hikJT6tE0iZCTz+MY4BOY4w2EO6zFBaOlMraEUFxPA= Received: from localhost (dhcp-141-239-144-21.hawaiiantel.net. [141.239.144.21]) by smtp.gmail.com with ESMTPSA id ja11-20020a170902efcb00b001d8921f2058sm1820644plb.205.2024.02.02.09.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 09:07:41 -0800 (PST) Sender: Tejun Heo Date: Fri, 2 Feb 2024 07:07:40 -1000 From: Tejun Heo To: Juri Lelli Cc: Waiman Long , Lai Jiangshan , linux-kernel@vger.kernel.org, Cestmir Kalina , Alex Gladkov Subject: Re: [RFC PATCH 0/3] workqueue: Enable unbound cpumask update on ordered workqueues Message-ID: References: <20240130183336.511948-1-longman@redhat.com> <89927d84-279a-492e-83d3-6d3e20b722f7@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hello, On Fri, Feb 02, 2024 at 03:55:15PM +0100, Juri Lelli wrote: > Indeed. I believe this is what my 3/4 [1] was trying to cure, though. I > still think that with current code the new_attr->cpumask gets first > correctly initialized considering unbound_cpumask > > apply_wqattrs_prepare -> > copy_workqueue_attrs(new_attrs, attrs); > wqattrs_actualize_cpumask(new_attrs, unbound_cpumask); > > but then overwritten further below using cpu_possible_mask > > apply_wqattrs_prepare -> > copy_workqueue_attrs(new_attrs, attrs); > cpumask_and(new_attrs->cpumask, new_attrs->cpumask, cpu_possible_mask); > > operation that I honestly seem to still fail to grasp why we need to do. > :) So, imagine the following scenario on a system with four CPUs: 1. Initially both wq_unbound_cpumask and wq A's cpumask are 0xf. 2. wq_unbound_cpumask is set to 0x3. A's effective is 0x3. 3. A's cpumask is set to 0xe, A's effective is 0x3. 4. wq_unbound_cpumask is restore to 0xf. A's effective should become 0xe. The reason why we're saving what user requested rather than effective is to be able to do #4 so that the effective is always what's currently allowed from what the user specified for the workqueue. Now, if you want the current effective cpumask, that always coincides with the workqueue's dfl_pwq's __pod_cpumask and if you look at the current wq/for-6.9 branch, that's accessible through unbound_effective_cpumask() helper. Thanks. -- tejun