From patchwork Wed Oct 16 08:43:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 21635 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 B9235C32FA for ; Wed, 16 Oct 2024 08:45:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5E93765382; Wed, 16 Oct 2024 10:44:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="dyHrr8JZ"; dkim-atps=neutral Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 06E726053E for ; Wed, 16 Oct 2024 10:44:56 +0200 (CEST) Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2e2ed2230d8so3721530a91.0 for ; Wed, 16 Oct 2024 01:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729068294; x=1729673094; 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=0Cs5eZD2XMxoHzLCM3SkkRPDVELL2yLfNCv7AeUeMqI=; b=dyHrr8JZpNr72MKFlShc3UQXZQmhdHznoLdz9Ew8YL/c58EJGiWc3EJGtHQ/4K33/g O4eS5fceewLonJJ1rJmZHQ4oHE+IWDltaJH9rFZbbjrqR0CvUfMInq1M8fn9FNNKFhq4 PGqSvqEL9T0Dm3IM/h4sihulQ7qDo49EWbkX0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729068294; x=1729673094; 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=0Cs5eZD2XMxoHzLCM3SkkRPDVELL2yLfNCv7AeUeMqI=; b=b6yaPbdkYurQ9xPyNwCcdnez5JGkbI13UeVfQKVyYDi5mWT8I33Y/r8wBBSH8FMZn6 Emps6sw3AMmGlOl5Ddbc35oYLf/ipDj3U3nnuli4X2N/GShG1IY6fCmRCCmr2u+y9IbF feYf6T9poF78vnHiffG0mhyhqU0yHTt2po6tAkcemuOKoS5ZXMjpGiPnvBh/Rj8bi60d grJjG7qw8s5wEvGEGsxqmVinbSSbfF9pDZehCIp/aQGki2hxaDgIZZd8MRe3nZatFHau JeJXuIeVsDOxqkW3kOm2iHLf2e6yaRsQX4MJZ/HypD0MX5lVlcyfMieKXYY4yt4xg7wI MlLQ== X-Gm-Message-State: AOJu0YxnAB342zDQhRsvcRpQ1n9lCpSggC8S3JtNZQRXIEvIidQGE4t3 rMx3kpOHlW40kSauPi9g4ly0rDgKIIQ7X+6ZI310Cf+l53znrL6jBvrDAt4HQgW8zp8Pjr12WzM = X-Google-Smtp-Source: AGHT+IFkwIb4L+GuIvvwpbO1Pcuyz5t7WNGk17mcNaN2QcXqzDNp8THlYhVkEoIuF5TMT5RIivzjAg== X-Received: by 2002:a17:90b:3906:b0:2e2:bd9a:4ff4 with SMTP id 98e67ed59e1d1-2e3152ea87cmr18684816a91.24.1729068294425; Wed, 16 Oct 2024 01:44:54 -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 98e67ed59e1d1-2e392f03756sm3508553a91.29.2024.10.16.01.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 01:44:53 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang Subject: [PATCH v5 0/1] Add thread affinity Date: Wed, 16 Oct 2024 08:43:43 +0000 Message-ID: <20241016084449.3566589-1-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-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/1291081 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 | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+)