From patchwork Thu Oct 24 08:13:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 21747 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A3265C3213 for ; Thu, 24 Oct 2024 08:15:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B38D465393; Thu, 24 Oct 2024 10:15:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="nUBGO80k"; dkim-atps=neutral Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D0C4603ED for ; Thu, 24 Oct 2024 10:15:30 +0200 (CEST) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-71e49ad46b1so416834b3a.1 for ; Thu, 24 Oct 2024 01:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729757728; x=1730362528; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0Vdh0H1AgUVZ9RTj9IjLiZnF7khRl/nxpjpy8wpj/4c=; b=nUBGO80kXssJck2KcX2Vsf9JOs42BK9+T+HLmYKBmFttI88X43EcnI40i4d0Sg8XPJ HRPL1jPFucQXw7AVDEEHtB6kGBi2fRVHY/nbmtDoIu+FulIvzGqRXF2RR5nfi06wseuc CyXNiHui9f8KdYE0cwblXJN8F5YIaMxKQEs38= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729757728; x=1730362528; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0Vdh0H1AgUVZ9RTj9IjLiZnF7khRl/nxpjpy8wpj/4c=; b=VkTa4iH6DGQIPlszkAW3RNMFj1Kzw0C7kn42qg+LjPG69wD4s/kz4GeLxdC4Vm5Yxk P0zRmzX0B99dxMrq8Y86wDu29y6gNJ3T9z6Op2P/SsrbzayXVUyjyGSiEBOj2BkwHpvM +Sonu+QLpKc0bzbKv4tOBzkx6EWTVwAFuOiV5+SGRHi/lDiPNC6FMLvLilrcQcO4lNtY gzT67JP71J5PdjuufoLpYFJPj6ybhhSjNMaf78vLXAapE0OSE91YNzG8EgaP3spwagYX CZoRX/+6iCVLJhfxrNlzriG+Y+dLZZ6Rao2ARsedXSXAzdPLS5GJUf1B1wfCmHmqkPin ssKw== X-Gm-Message-State: AOJu0YzmNBZaWvoUJc44xQRqVV8wx88rFwId+Us4BpSdP3XvKuoNjDJQ 31CZelI77w7zWBDDraxuVf52zAWf2koS7NwJMgs0GrOkFp+YGDedxqbY5LfECRx6EC547Dvr7DQ = X-Google-Smtp-Source: AGHT+IFZBOYAvQ8XYlUd8Otkg/4qv2G66Ew5917DlOTlujOl5TjeKEq8QAIyXgkhG4RwGhoKsGsZig== X-Received: by 2002:a05:6a00:1a93:b0:71e:7745:85b8 with SMTP id d2e1a72fcca58-72045e257b6mr1228653b3a.1.1729757728233; Thu, 24 Oct 2024 01:15:28 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (199.211.81.34.bc.googleusercontent.com. [34.81.211.199]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7eaeab1e5cdsm8068360a12.21.2024.10.24.01.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 01:15:26 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang Subject: [PATCH v6 0/1] Add thread affinity Date: Thu, 24 Oct 2024 08:13:52 +0000 Message-ID: <20241024081520.2912819-1-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi folks, This patch adds a method to set thread affinity, which is needed to ensure performance in mtkisp7 pipeline handler and IPA. This passes gitlab pipeline: https://gitlab.freedesktop.org/chenghaoyang/libcamera/-/pipelines/1296466 v6: - Set thread affinity before run(), if it was not started yet. v5: - Return failure if any index is invalid. - Drop the check of max size. v4: - Use `sizeof(data_->cpuset_.value())`. v3: - Keep the cpu indices in ThreadData. v2: - Check cpu indices within [0, `std::thread::hardware_concurrency()`). - Limit max size of cpus to be CPU_SETSIZE. BR, Harvey Han-Lin Chen (1): libcamera: add method to set thread affinity include/libcamera/base/thread.h | 5 ++++ src/libcamera/base/thread.cpp | 47 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)