From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 184F4235C07 for ; Mon, 13 Jan 2025 10:13:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736763193; cv=none; b=fc2LIvDE+uD9s3DtdF1luIgrt6VSaInO6el6gfLWDJpynqJtg7vsiP7cMHLBCOHg5AF/tS3aGE11VoPfn0ed4v41L1Ee1rom00I7iGHaMwWg+OeCl7CTomLR1dFNug4uwGOFXQUM1hLqMFjtNo9fok9HqfQJXtpPINZf3otn1nQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736763193; c=relaxed/simple; bh=m1MIiqTu8zyFR8wtxdazcfmKHE/kHA6mgPQvXUbeKUA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YFE8q6VKC2X8/kNi3gnMkmmR7LN6qm4IkLWroIWtHpAhTFsQFjD4Y7QR/C/1CSRNwyncuajunNT59NbA7k+AZv6s0yWyYokw0e/4tPAFWqUbKXCcvllbnRUjoT9U4DYJHhMkjvOF+G2/emzm4BK2tWvS5NKbh+ln2dlWzHSl3bY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=abt7o6Jj; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="abt7o6Jj" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2166022c5caso61845275ad.2 for ; Mon, 13 Jan 2025 02:13:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736763191; x=1737367991; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3MQXGgraN/+MwUt79Lfy/JARmt1acIitZLPXycuWNv8=; b=abt7o6JjtkvaYWN2elNadHOS9tO48v4k2dHagb1zoZhy4flsBfn2cIXP9Fd7WisNcB Gyw2I59A96p2/XUvwagve8QT+A8Dtc792dKqb0USYjRABzObtjTa2JgO5nlF9UcvMxzF nTb5zr0o0Efqj19Cd8nKlytFi/+de75FaIizDsKhgXMNvU05M+5/5PDGQqW1olSpWRNc pf2qcF/vLIgOow9Z6q3e3RTlcjR2CT2hyxCKUHtobxyUz/ODTs4U6hj2mMCNMFuZ1tJ8 vgzzpFqyd41W+N9GKjq51zPkCEviZ2t3K5YyN+h2E7inEC0V0KuWHHnGMD6hpQfSs2Dj RZuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736763191; x=1737367991; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3MQXGgraN/+MwUt79Lfy/JARmt1acIitZLPXycuWNv8=; b=i1oKB7B7AbWu1/i7k61aGGQUxxlnazhjiO69fnFRLwjhQwXLaodukn/rkA47L/Twr8 JFRLkyvSzxoAijOaQwGlFAFJEIwNveX4edIW9CI/sp1G6xlgs34G9iyYm+i+ULd1N3YY utpxmn3Wj8ij1c5HihutT+dtqdUcMHov3WsxxxGMY3UMaBL1AztNdNiZiGCXFpdM8fTM HibJLGMi2MvreGNMlokqpo5lFCS6fw5lI6cPC57F80ENIUto4f/+I+s3EPDqvSE/2Kf+ ZKLKCIqb3A3Hic95UkD/oVBn/FSKvO8FrqSAxiory5mqq1gj1u04xhgvvHofhMMy3Jin SbJQ== X-Forwarded-Encrypted: i=1; AJvYcCVkvINlHqaVMzH1bcmi5hT+ixWThzkc8HuLjc4v/q379SIxRO2yWQcbtqHivY9r2VbJy67bfzSbUp/fOTs=@vger.kernel.org X-Gm-Message-State: AOJu0Yx26eslXMT9Gokqwtbxeo7Pd4QPx+KZtNo/oeZSKCeCLiM7BT4k VgDtpD0TNJ1L94Q4nhogTE534xbxvuOpL7LuahDMJfHoRwuKRg5z X-Gm-Gg: ASbGncupgN0pt/f/TrN/XwWnUHSjCWtmjeiJ3Jt6PCsZ5rNtWC2jxYTSetCIj3NuNVT Aam4t7AB3bRWXo3fwAJvMKJNuuUOjjcYQPrfoFxVZeIGjiw8cS1ZLxeN8t7GqOacHn8HCUs565L tKrOINu9MUAFSigkpXlIQPJzVnxmUquQ7NXWbqCLgeTjg3+gOZtVar7zI4gs/bgOzngBydbbA1d KgvVJ9/t40Otrl6wW8r3QBaAMV/ug4bi98MI6CrAiG8FU0eXJoAGsy9HyP/bVWbkj75HEWquPoi D+BBWGOj X-Google-Smtp-Source: AGHT+IE0Vr1twzeh9c/tFwpKeTp+gTd6TUpE8UdBHM433iqi6Mzs7IozJMHMhun/hLHsOiuNRaD+LA== X-Received: by 2002:a17:902:d2ca:b0:216:56d5:d87 with SMTP id d9443c01a7336-21a83f8ea52mr314612235ad.34.1736763191199; Mon, 13 Jan 2025 02:13:11 -0800 (PST) Received: from visitorckw-System-Product-Name ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a9f12fcfbsm50681735ad.82.2025.01.13.02.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 02:13:10 -0800 (PST) Date: Mon, 13 Jan 2025 18:13:07 +0800 From: Kuan-Wei Chiu To: I Hsin Cheng Cc: yury.norov@gmail.com, linux@rasmusvillemoes.dk, jserv@ccns.ncku.edu.tw, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] cpumask: Implement "random" version of cpumask_any_but() Message-ID: References: <20250113061839.22131-1-richard120310@gmail.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: <20250113061839.22131-1-richard120310@gmail.com> Hi I Hsin, On Mon, Jan 13, 2025 at 02:18:39PM +0800, I Hsin Cheng wrote: > Original implementation of "cpumask_any_but()" isn't actually random as > the comment claims itself to be. It's behavior is in fact to select the > first cpu in "mask" which isn't equal to "cpu". > > Re-implement the function so we can choose a random cpu by randomly > select the value of "n" and choose the nth cpu in "mask" > This patch may slow down the efficiency of cpumask_any_but(). Are there any in-tree users of cpumask_any_but() that require it to return a truly random id, or benefit from such behavior? Regards, Kuan-Wei