From patchwork Tue Oct 15 06:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 21626 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 56AEEC0F2A for ; Tue, 15 Oct 2024 06:55:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CA29265382; Tue, 15 Oct 2024 08:55:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TgZY23bO"; dkim-atps=neutral Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F770633C9 for ; Tue, 15 Oct 2024 08:55:40 +0200 (CEST) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-71e5130832aso1626393b3a.0 for ; Mon, 14 Oct 2024 23:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1728975338; x=1729580138; 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=gUZ7Ip67h1E9hIH1zeKVZ8IfGG1qkzOmxPj3yXslg8k=; b=TgZY23bOGqjInIAsvQRl3QZ+RVEyzMI+dY2uD66zuQmlbJsqIVqeaZ/rZGAcgmu071 9x2H8djf3ZvCNe38hC0wnreFNSmvS/M/2t2hofsaWi0EeVKnhlXIz3COnsmUBUHvekLV gXghCkMOmxzeCnapDSjMBEKuNWUGJe0ZlN6ew= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728975338; x=1729580138; 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=gUZ7Ip67h1E9hIH1zeKVZ8IfGG1qkzOmxPj3yXslg8k=; b=E5jI0gBf4+61iC221ZTxbQvI4Co0GQKR9BOPBl13PUOevCLRb/KByE8tQ0v6WBrrLi bFC1qrcvRX5MukaR0JgIpvTykRZ9jdP7fD+nMD0aR5cdvw2o8r7xIcZiic1ADqiFe/nl bJynY15soH2kXhic7fq1PWmZMXvCEgjk/nkPY0LdDMHUvwjd1OAM6eRA4KoLGfe3lIHr hxZtUEPqPEoAvWitFiZzRE5nNWaBYP6AwbOwpoQ/Qs4gJEmyylpCxbVm8ah9q4nmfPuC cWPMQ5Cr3D11YHyfeXh0ncnNDUEyDwz5kCi3WJhbYIXe8D3WxpHGWIRlDTVgKx/7OX7v /m7w== X-Gm-Message-State: AOJu0YzRUCDl/kNbLSWaPTYV7PR1NuIz6twhQQSKvpZEtpy4mkGmmB0Q vV8ZRIc+3iLun+qom5WLZ0az/hYuW9Tcoy/nKGm4qT/Ict9ZisTsFXj/Y69C4vf7ceAWQcRJMNM = X-Google-Smtp-Source: AGHT+IGzxwCljXOIbuIVSAe17WbwHpfm6JJGjTQ2BtVXqI+vUoxXycZPCe2GTFyOF+ABfWWRBlCL1Q== X-Received: by 2002:a05:6a20:c797:b0:1d3:5208:1ea6 with SMTP id adf61e73a8af0-1d8c96ba5femr16287061637.45.1728975338543; Mon, 14 Oct 2024 23:55:38 -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-2e392f75624sm790215a91.53.2024.10.14.23.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 23:55:38 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang Subject: [PATCH v4 0/1] Add thread affinity Date: Tue, 15 Oct 2024 06:54:35 +0000 Message-ID: <20241015065533.356466-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/1290319 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 | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+)