From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C98C345C6E for ; Sun, 3 Nov 2024 17:10:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF2C44014F; Sun, 3 Nov 2024 17:10:35 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 69B7A4014F for ; Sun, 3 Nov 2024 17:10:34 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-21145812538so3276075ad.0 for ; Sun, 03 Nov 2024 08:10:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1730650233; x=1731255033; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=oRUsT/9hs+IWyfWoRhofREiZbj2Z7RYkCfbmO3a5WLo=; b=GZuQ3Q56lQTbtU7BS3EMKbktL3PETGqlw3E6P5kYLN80sxDrA907zgv6ABCQbmngC/ R31QetcwP9xVDN7JChTaoiwnTdnoiqhdhOWG4qSN/UELNmwcSTRWyfgNoXWU6OFCeUE5 strMryo4Fv0j4P9Zk/lXXEPWb9Rw3boM2V/YvbQcDAM/XL0HVtD1PqZmKD4HvBqbICI4 8ggsuPb5zuRFZIi5pgG38kWw5zyU+9yPpnsOfIthsiF+eYuIpSinz5wx4sGax228MOLD xNzGx4Z6EvZPjD4YM11YKwjdT/R1MD+qLOqD4EBWRkamSIgUwwLlb2Dkebk6xTLYhcDx ZC9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730650233; x=1731255033; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oRUsT/9hs+IWyfWoRhofREiZbj2Z7RYkCfbmO3a5WLo=; b=Yvctc2Fyv02Jgemk5tSd6khakZCmToNwEpkCDfBtWSp8tL9Q7c0MpO28ZY0vKO64Jv rvzat8r7gA4lpyWtRGM0pEa1oqa687V+GbDgEj6ehLRlICeUduI7yRPCSXoXG9JvwoWM h1vgToSVDmXFChKqY7mfUf3lmECYwL4ujoig/OeEpsq0e0/rWK58BNObyUNgP6Vp+FqP tRI6M2x4U2rkO3neBMiqTHLvVUujTdXSigiHE3xgqC2UqY/0MK7Zz5hX9uMKV/PdyM6U OV/zsc80114ItkW6k9CbTI0tTeJ7QWEODdoAkVAJ/gMaIVFIxwHU+HLLJncDDwpALC0W tOVQ== X-Forwarded-Encrypted: i=1; AJvYcCUXC4fNCnUZtQbVL0yHxRMCLzMda6NyoATE+IW1zVCM67E5jpk0ZVKOYFGir4QlCacOYoCw9xI=@dpdk.org X-Gm-Message-State: AOJu0YxPYPFkY3s16XN6GxpSZgHmv8imkKT6DHdrNAkmCyxz8Td3Lkpr DOHdb7xij4VYemymq3h8tVoAqtjWdISkMf/ryu1qKWLjMbvTskZ997Es4GkGAQU= X-Google-Smtp-Source: AGHT+IE4JVNbZdZVfpcB8daogamINABgo8dVCNmObAK0DK6vOQ3cCidT2BmthEoACGmzbXX/CGV5rQ== X-Received: by 2002:a17:902:e80f:b0:20c:5a64:9bc6 with SMTP id d9443c01a7336-210c6c92b66mr356393115ad.50.1730650233438; Sun, 03 Nov 2024 08:10:33 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211057a2f18sm46427825ad.126.2024.11.03.08.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 08:10:32 -0800 (PST) Date: Sun, 3 Nov 2024 08:10:27 -0800 From: Stephen Hemminger To: David Marchand Cc: dev@dpdk.org, thomas@monjalon.net, luca.boccassi@gmail.com, stable@dpdk.org, Luca Boccassi , Tyler Retzlaff Subject: Re: [PATCH v3] eal/unix: optimize thread creation with glibc Message-ID: <20241103081027.4366454e@hermes.local> In-Reply-To: <20241103112519.2972691-1-david.marchand@redhat.com> References: <20241102100839.2325651-1-david.marchand@redhat.com> <20241103112519.2972691-1-david.marchand@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Sun, 3 Nov 2024 12:25:19 +0100 David Marchand wrote: > Setting the cpu affinity of the child thread from the parent thread is > racy when using pthread_setaffinity_np, as the child thread may start > running and initialize before affinity is set. > > On the other hand, setting the cpu affinity from the child thread itself > may fail, so the parent thread waits for the child thread to report > whether this call succeeded. > > This synchronisation point resulted in a significant slow down of > rte_thread_create() (as seen in the lcores_autotest unit tests, in OBS > for some ARM systems). > > Another option for setting cpu affinity is to use the not portable > pthread_attr_setaffinity_np, but it is not available with musl. > > Fixes: b28c6196b132 ("eal/unix: fix thread creation") > Cc: stable@dpdk.org > > Signed-off-by: David Marchand > Acked-by: Luca Boccassi > --- > Changes since v2: > - added pthread_attr_setaffinity_np() detection, > > Changes since v1: > - fixed build with FreeBSD, Looks good, reading the glibc source there are internal flags to deal with all the states new threads have to deal with. Glibc is complex there, but comments are worth reading. I wonder if part of the reason this is more of a problem for DPDK is that by default new thread inherits cpuset of the parent. So the child thread will get stuck on same CPU as the main thread. Acked-by: Stephen Hemminger