Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2324311lqo; Mon, 13 May 2024 15:05:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUd6cjxkSEiRLVKH9YzFelLZBpvMp5zXDOwKgT0JsjGML3jZIoEFxfl3HJHhjLk09RjVHPHW5zaJXzdvSsrMmSM9zqXN4uxbym7TCiIWg== X-Google-Smtp-Source: AGHT+IHyZG4+n5XN1hmZRoCAuMcfzwpWl0wVeSfU4WEQlaoAfqDCMFWkUZBzierB5tFHWs32Ewqs X-Received: by 2002:a05:6a21:33a3:b0:1af:59b9:74e9 with SMTP id adf61e73a8af0-1afde0a9a16mr14476063637.2.1715637907398; Mon, 13 May 2024 15:05:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715637907; cv=pass; d=google.com; s=arc-20160816; b=dw13vycMsORAe1SYCTNUQpOS/ixufDtMjJ85z74Ju56KDteBmoKWLaXeUgX6H3wayt W2Ldpgi02QF9AIY6F5TnuMICJewdureKElQp+F3ppcuI1m0gy/a5OgS+TOz6ykpwgS+o bavBPOKD2+ig9CP3PB9wYCjSX9M9NzeYAhOdlWHIpxJwiWtHW54Rf1YKZXxk/nJ5aF6Y I+JNHi63elQCp3y5aXfLTGUhNdtE4m53wJb/FL0e0GwdQacEILGXulIwzrnJhfDmvmiJ xR5FsvFx8H3mtjwG5BK5q7JXwVT+aT4JTAkeXvMSgsWRsf1FfXl6ZAAcNIpjfn1Q08Ur 15fA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=QFQwRbO5Y/SwpSfXYkkqhhf8QwJBkym56pFBFXHGIfQ=; fh=a0C5WO6lw716+O8aRGVFUF51rSXLsgT1DQ9a1NHZjfk=; b=T6/YuuXdUbJxyHj21Da+glt4+MoeCuoyr4U/ZLOwB8Z9R18qgAlax3XMTs+GvbCtQI DRduUxXhaIdOl2uCsfCjVIlA/IrstxfabdJR6XjmRae7u1j0NTlbb6liGyqRUdEthfcw tqfVqJeoEG/Ox3+3N+KBddyBxEZl8QgRQ2lA3ODG7eir3mBIzkNJHE8nc1T2pE1aW3iE ZNMuurRHRj0JP7UAxteTR+FVTx1Sb4o1xZC4C5FWeNAZooXRaw7353JK58uX7MX7uqaY 6YAj/gUguAGuDwk4bRwMvpnwld/1gHHiJTi+pko+jlZ9sESRvLQJHI7QB59iruecZxbj 20Wg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eyEFS17e; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178129-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178129-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b6290d026fsi11993992a91.160.2024.05.13.15.05.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 15:05:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178129-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eyEFS17e; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178129-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178129-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2DB14B23A11 for ; Mon, 13 May 2024 22:03:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 250E484A4A; Mon, 13 May 2024 22:02:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eyEFS17e" Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03D5684A3B; Mon, 13 May 2024 22:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715637720; cv=none; b=n3rvseBjgTh685gpIj3CqlVPYEvPK2nz5/SecQLUbe9kDZJdnzbhYxPdxY8JvnxFiIQ8GNP3WaOqbA5n6lE66/fBjvi3itxnuluil8YDUetpAhyIlnteiRYOoqvMFhfqe64/6siDcKS/UTsG2tY4R7vxmSfE0sbyNlBpu4KRods= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715637720; c=relaxed/simple; bh=PmUZF5vuqc5KffzerVNSVTNAR1dfIS9Fx2N+w9iYCaM=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RUAjnB/ug3tBB3ahDZClznGlxDMwnrL6TzB30PH4drsI0Di/OBg55IqVmttsurYUJjbwkAz9/NmB0vOQ5pyxbvDfid2UQp9nbF7qs4pFxwsz+aa7Bv6FMWgaFoQnfF9RXpDywfsEzognY+/1xstWXSquf5wil4TlAMssx6V/y5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eyEFS17e; arc=none smtp.client-ip=209.85.128.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-61bee45d035so50586447b3.1; Mon, 13 May 2024 15:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715637718; x=1716242518; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QFQwRbO5Y/SwpSfXYkkqhhf8QwJBkym56pFBFXHGIfQ=; b=eyEFS17emt3Wi2+bz8GkzUXy7r5tP9qhA5WroV9b1Zc2Y5LQ+9Lf2Erg8nm+Y6GGoo 6Q6weLcOyHnZGzIqniaRNz5wjOt8AsNVBYjDbvEjylvgU+dHkj0SQjzW40v8FCr2TGf3 x/lArl0hWLX0g5rEojoOb3d7nyRf7yAIFgr6HaqyCBpfPMly7/+qYGCq806lCMqjtA6K l3iaMT0l33paGjhu8GQCAvaC7SXTEqoObTRojcYWpUi7wrQVi2mUD/5BTwv1oK4AfxSc t1HLWoKZqv8mHufGjexITCw2b4rPlzAzgSDMg57nX9LKgAMKlyDi5TbeceqL3zTquKpN CNFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715637718; x=1716242518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QFQwRbO5Y/SwpSfXYkkqhhf8QwJBkym56pFBFXHGIfQ=; b=EFeeHQH/GAOrTE4CH2AjBMwT83Kzb0UQrawPxCjBE9IW1qocSz7Oov80Obo7QngzUR 6miLGZNQAXrN/wgFG5fO72Ud7Dgv4A3M4DDjqbkM5FEiyY9RZJpmBeGoUFqloqg2xR5z mZDFhEUDpT4bqNfEY7ikBTak2vMMsryh8uVzwc4R2clbwllhLdHYLo/bU44QKw7p6PEx GaQEaeaozvzE4MbGp8XpLjyAMxVQ4ewELnJnwR7WrhcgAn+Z186FpZP7fHVuIHJeHpdQ Y7J+BHthKwd5WAbqq1GCHRlgPlgh7vhIi6XCa4kp9Iz5NJeC32jLP10JGon9Gm5S28lv yNJA== X-Forwarded-Encrypted: i=1; AJvYcCWwjt5jEYmTc7x741QJkSRHix8OiTKELE7qBRf4btJc4i3DlJQFv8pzNYQodFZNfU3Qp0l2uTY2GlH+DsAsp/PUePHXQp/QkA== X-Gm-Message-State: AOJu0YyBGzKEZvQmwjvXtNOBn1wEN0pnf9KFM00X8+yqUsHwMsX/5kdU n73EayZUYZ4dYnxzpngbxTT+7P6pZZJtIBAcG5aeDp5nR1UrdC5uFNlQNA== X-Received: by 2002:a05:690c:15:b0:61b:1a4f:158b with SMTP id 00721157ae682-622affc65c2mr113804967b3.6.1715637717837; Mon, 13 May 2024 15:01:57 -0700 (PDT) Received: from localhost ([2601:344:8301:57f0:8acf:1c06:973:d499]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6209e233fc3sm23098497b3.8.2024.05.13.15.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 15:01:57 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Paul E. McKenney" , "Rafael J. Wysocki" , Anna-Maria Behnsen , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Frederic Weisbecker , Imran Khan , Ingo Molnar , Johannes Weiner , Juri Lelli , Leonardo Bras , Mel Gorman , Peter Zijlstra , Rik van Riel , Steven Rostedt , Tejun Heo , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Waiman Long , Yury Norov , Zefan Li , cgroups@vger.kernel.org Subject: [PATCH 5/6] cgroup/cpuset: optimize cpuset_mems_allowed_intersects() Date: Mon, 13 May 2024 15:01:45 -0700 Message-Id: <20240513220146.1461457-6-yury.norov@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240513220146.1461457-1-yury.norov@gmail.com> References: <20240513220146.1461457-1-yury.norov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If the function is called with tsk1 == tsk2, we know for sure that their mems_allowed nodes do intersect, and so we can return immediately instead of checking the nodes content. Signed-off-by: Yury Norov --- kernel/cgroup/cpuset.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 4237c8748715..47ed206d4890 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -5010,6 +5010,9 @@ EXPORT_SYMBOL_GPL(cpuset_mem_spread_node); int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, const struct task_struct *tsk2) { + if (tsk1 == tsk2) + return 1; + return nodes_intersects(tsk1->mems_allowed, tsk2->mems_allowed); } -- 2.40.1