Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2811961lqo; Tue, 14 May 2024 09:48:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUZVPXt9YLvdEEF4Jy1odYU5HpiqeXBXw05mT1N3Iv4qlmlRW6lUp1DRQQruolkIAyVIgHhgKxfLrTAXnNgAwJREwUJOZ2Q6KzugQy3A== X-Google-Smtp-Source: AGHT+IFSGVd+F6WHO3qS6M+DJEqIyb1DVtyeaWwf9J0oYWYGTpYD9QEExzSwJEN4e3SyGC+wCFdh X-Received: by 2002:a50:9991:0:b0:56b:dd0f:52e0 with SMTP id 4fb4d7f45d1cf-5734d5c2ec9mr9009859a12.18.1715705307138; Tue, 14 May 2024 09:48:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715705307; cv=pass; d=google.com; s=arc-20160816; b=EsXVYlCXtn56h6w8W6CTARE9ULJMj9HUVckdGT5ckQwK1LqXJrL++2l0rZJEsRv4qg wa+RYnPN/1Bb0p9NfvfeVsCQYw8hQTW4pQhwxgkJjW8yh/QVr4n/21OxFgFVH1qNEMvB iMeAZ9CHxTXtMNGTZz3oPxhKl4/pAligmWTUo7JNF8CaoeQ9COAmKcE0k8ITFxoG071M ho2X85Z2Gfb4aHY12/WrhJXbXE5fz/hQAx3VM+arU5nZk7WVTWKdsqmsowNS6/aFIkkz mE0DAdGmppJDHbEZq2jJW4ZyIUoFgL8Yy2f9KvgjYxfIFEkblvwe5yUjEahM76UR9zGR 5Xxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=3yPKE/w5eUj9cE5mu0i5vJKgEGLHkvzbGLmCvqOXubs=; fh=7yQci4cIhqppAlXtBbk0Xg5xxqqVSNjf9jPgxJQLlH0=; b=eqDrlYH5xe1Td7sZBuz+iXBJn1fDNRpzJfZf6VRwY9gJCF+Rf+l5skb8Rz9yn7DYGa n89YoSQ4amRTJ9ineZbn71eBzQstC4l4DAMVUFNXN0VtMe4cEBg8/VqJ0Jcm3CwoxkVx bsOEp7+Oq+SeYCYAGNOsbBb+jZw33b8IIRio1SOA457a+X2nq/dPlFchiN3xoXzLOBi4 75MsT/2q9WmVqyFf8ac8NXEGaUZ4Rj7FmUxezesc8Fhyqe0JJAjmc0ZX7s6hRwqg8Cg7 06ZjDJPLeBuLriDoVdFjB6k6pxB4rzdz2hjMWJMXYKode+fMN5Bo4FaOpxHCsCMnQ3as WQ6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PaeubQQ0; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-178965-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-574ed8fd615si157583a12.470.2024.05.14.09.48.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 09:48:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178965-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PaeubQQ0; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-178965-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 am.mirrors.kernel.org (Postfix) with ESMTPS id DBBD41F21F52 for ; Tue, 14 May 2024 16:48:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9688B17F378; Tue, 14 May 2024 16:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PaeubQQ0" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 445BFF501 for ; Tue, 14 May 2024 16:48:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715705300; cv=none; b=P+bJKIn7KW16lcEz3eHYLo23SimUI1DcyFfRyGiVkSlel9kHnPEHokXmzz89ItG8l7b524bg7QfUqyBeDwkZqHwu0mrjBdwF1ypcM3zoIDnvyEmmilSUiPaLKqWROcZQPF0yxx/mhPQ5pAR33amlQd1RTku2xFzY0LRlVt4AhjM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715705300; c=relaxed/simple; bh=ordsi/vf7xq5Mpx0wPQqakHQgTmZ+T7L0Wq0WkySFGE=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=ilqIAjvhNbiiTXhEhxA9qwNqDRk0Nu9USgr6OFdYbPLOoQUuxgqV1UC+9DkBddejo5XunxuGjTPym7KhYRf6tiYzIKNslLIRijRQhre3YU3pClXNh0HG54WmfHWQ+jtrk/uzM6cfodloC9vycrcrf+nyK9vZZmxEEckcKYs8NRE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PaeubQQ0; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715705298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3yPKE/w5eUj9cE5mu0i5vJKgEGLHkvzbGLmCvqOXubs=; b=PaeubQQ08/p3vNiKdcP8FmKiOo50JDM3hc4fIl0OlA3claqvXuvIBoKQrpRKC0/D8W2U9m LrjHMymuQy5AIlPd6RYYCpZ9NBTma5GKm/gkPkOmWjo9tYDM2vfz4GVZDW8hkJtX66gyNn p588AZk28nzAbn+0qax83Q7ETOsxrL4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-488-zuLSYt1OPHG168KNbQHKJg-1; Tue, 14 May 2024 12:48:03 -0400 X-MC-Unique: zuLSYt1OPHG168KNbQHKJg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8D7338000A0; Tue, 14 May 2024 16:48:02 +0000 (UTC) Received: from [10.22.34.104] (unknown [10.22.34.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F6E040228A0; Tue, 14 May 2024 16:48:00 +0000 (UTC) Message-ID: <911ca229-4849-4fd2-8ae8-5ca653d8a5e3@redhat.com> Date: Tue, 14 May 2024 12:47:59 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/6] cgroup/cpuset: optimize cpuset_mems_allowed_intersects() To: Yury Norov , 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 , Zefan Li , cgroups@vger.kernel.org References: <20240513220146.1461457-1-yury.norov@gmail.com> <20240513220146.1461457-6-yury.norov@gmail.com> Content-Language: en-US From: Waiman Long In-Reply-To: <20240513220146.1461457-6-yury.norov@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 On 5/13/24 18:01, Yury Norov wrote: > 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); > } > Reviewed-by: Waiman Long