Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C6CEC678D5 for ; Tue, 7 Mar 2023 17:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230473AbjCGR6Q (ORCPT ); Tue, 7 Mar 2023 12:58:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230221AbjCGR56 (ORCPT ); Tue, 7 Mar 2023 12:57:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46807ACE20 for ; Tue, 7 Mar 2023 09:52:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8B0361507 for ; Tue, 7 Mar 2023 17:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A427C4339C for ; Tue, 7 Mar 2023 17:52:25 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="o7gAowpu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1678211543; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y2dpmT/ojXxiEeqa4iyotuL0U6Ky5fG3bCAhuvP7SOs=; b=o7gAowpu+WwEcc12XzCoeq7TFYt2x8xTPHUlM5Eok6prB0c7FhG44GM0BXK9rdSl8BrsFL 1x0SroyMobwLy0LGqa5ssQwlswgp2qqrnYETibZjZ+trjne8uo9aCDi3G8tqp0hFjxkKOk c9CMkWKNtp0it05x5g7HwjXp2GIRXoQ= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id c5f9cad3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Tue, 7 Mar 2023 17:52:23 +0000 (UTC) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-536c02eea4dso258898487b3.4 for ; Tue, 07 Mar 2023 09:52:23 -0800 (PST) X-Gm-Message-State: AO0yUKXOP1FJq7B4hDe6CK1xFnDGGC39643q/ssDtmflfPPa7Z7/Brfn OuwwNhcBvyxZkqtdX+6Rdes61509/GijEB8WPs0= X-Google-Smtp-Source: AK7set+fq0Koq84/LVB8GJiN9PVIlu7H9xrrfWg5nppb5OafYmSXCIIC4oCuGpubOj1qw5eHppovx2vew/Q5jTfDzIA= X-Received: by 2002:a81:ac27:0:b0:52e:b488:744b with SMTP id k39-20020a81ac27000000b0052eb488744bmr10008487ywh.8.1678211542963; Tue, 07 Mar 2023 09:52:22 -0800 (PST) MIME-Version: 1.0 References: <20230306160651.2016767-1-vernon2gm@gmail.com> <20230306160651.2016767-6-vernon2gm@gmail.com> In-Reply-To: From: "Jason A. Donenfeld" Date: Tue, 7 Mar 2023 18:52:11 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 5/5] cpumask: fix comment of cpumask_xxx To: Linus Torvalds Cc: Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, On Mon, Mar 6, 2023 at 10:28=E2=80=AFPM Linus Torvalds wrote: > > I'm looking at wg_cpumask_next_online(), and this: > > while (unlikely(!cpumask_test_cpu(cpu, cpu_online_mask))) > cpu =3D cpumask_next(cpu, cpu_online_mask) % nr_cpumask_b= its; > > seems very dodgy indeed. I'm not convinced it might not cause an endless = loop. Indeed this code is crap and wrong in multiple ways. I can probably simplify to something like static inline int wg_cpumask_next_online(int *last_cpu) { int cpu =3D cpumask_next(*last_cpu, cpu_online_mask); if (cpu >=3D nr_cpu_ids) cpumask_first(cpu_online_mask); as you suggested, which is indeed a lot more straightforward. I'll get this all cleaned up. Jason