Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1223769lqa; Mon, 29 Apr 2024 01:49:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmxcDzNkV9TE/YskJ/DcsNab2T2TJTbBEn1CekdvwC+Bn/V7cvinUk7x1nGVwL1iBem8pjVUj8ahto+hWvVFTw+f2xEEVy64od6f4+PA== X-Google-Smtp-Source: AGHT+IG5LunrdwIRiqhLD77IlcX03QCK4p/jsRqLz55p7TIH53BtMjPXQdT/yzJjX/1F4Il1t0Bo X-Received: by 2002:a17:90a:9a4:b0:2ae:f53b:113a with SMTP id 33-20020a17090a09a400b002aef53b113amr5736922pjo.35.1714380541256; Mon, 29 Apr 2024 01:49:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714380541; cv=pass; d=google.com; s=arc-20160816; b=s59mTBvebJelIw71O86tB0GUqu4h8ZZKsfJRBnXI1oTL5GlVxRka1Lw3WDJnOUcdcT jDhS40/DyM8WcOQo/cGggG52RfCCuw0e76cmbxEGlOHgcR7jd+l2i1BdwEQBfEmojGQQ MIHCGSNP+aFKhXq1niRY8mlP6tFS4Znj9+8bp8ZBBBuq6OxlcSBlbMV269UIrx7rw+9Y rc3kwA1jbB8xIP9b4I9Yh0G9ljJSf4ATCqhY/7ncAFJZdQjcn+BoiR08ttkbrQCwgGUO 55cpaFOgYCN6ToMhBU3X8BW4NfjcHujsEU4wkUoXj2QkQYw5Yi4zfrKUgZsrmrb3CHxS VJCw== 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:message-id:date:subject:cc:to :from; bh=4ca2qXzpQXte1s0tXOAzVXPCfF876XxJz1REFI7F8UA=; fh=Foo9bXAFKzulHB1/ixTXZ21QxFM4KBxwcuD+LncWLqQ=; b=YSMHsrpUuxsWc3/C6NxdL0zp5uJuFV/g+o8gAA/bF/SN1CfKjG5Vd71MsY7Edbv7PA bHFlEnsZAZI6zBplW4Beu4xB3f/cc4lmqLGsBbxzFDGNYvzS/w3Ki3DwDIiYwaM98Lqz 6LQ0KbztycOdPSAx5qAoFljbgji8aZjn+k6B77252lUODdlWLVsPKf0G+wH7lOcdcHmY aOwcJ4x/Mo6w2DT473slNsmzEZ/DB5yDp0xPmMWeas9O80NMTC6PMO7rCpjkXBHtOuTW ITO5kEdH5qXM0qTAtJx3C3KKK6mcJDQQ77gb9poiP5woWLXcLXuke6zE2ju9dtyTc9gE JQsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-161927-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161927-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fy12-20020a17090b020c00b002a2c3529123si21038942pjb.184.2024.04.29.01.49.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 01:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161927-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-161927-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161927-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 664AD282386 for ; Mon, 29 Apr 2024 08:48:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F34417C69; Mon, 29 Apr 2024 08:47:49 +0000 (UTC) Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) (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 EE4AC611D for ; Mon, 29 Apr 2024 08:47:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714380469; cv=none; b=poQdeaJwmNBHa1ecQBTSBPVWNo6mFn1OLowkMW/Y1zBhUieDK/idcdINLg66q5TWrx7OZoQWod0SJCoftQFhz+TUa16cQJtJCGmqmOqHlv42O+VLERu57lytVTofXFybqDiR9RkuyHnkc6MoDGouClDXPVovbphNxdF6VZFFufk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714380469; c=relaxed/simple; bh=4yneeJLx+f0bOXwRDzrvGNhavRWvgBVi9UZ/ywkUr3g=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=iFWHsdQO4xImjG1u2TNw29p4a2YGURxufFupNWl159yjdXLwnWt0eo/CU2KfXD7b5N6Ec7HjjY3lL27pD0McdsEQuGZijEWD3CkcSrcecpsAJczNNnZGmBvKf+la9CEmeeEM5L+/ny0bEsqXMpepzkExyK5gOfeoWJ4Z+PhERiM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 43T8kltI069189; Mon, 29 Apr 2024 16:46:47 +0800 (+08) (envelope-from Xuewen.Yan@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4VScLm0mpmz2K1r9q; Mon, 29 Apr 2024 16:44:00 +0800 (CST) Received: from BJ10918NBW01.spreadtrum.com (10.0.73.73) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 29 Apr 2024 16:46:45 +0800 From: Xuewen Yan To: , , , CC: , , , , , Subject: [PATCH] sched/proc: Print user_cpus_ptr for task status Date: Mon, 29 Apr 2024 16:46:33 +0800 Message-ID: <20240429084633.9800-1-xuewen.yan@unisoc.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL:SHSQR01.spreadtrum.com 43T8kltI069189 The commit 851a723e45d1c("sched: Always clear user_cpus_ptr in do_set_cpus_allowed()") would clear the user_cpus_ptr when call the do_set_cpus_allowed. In order to determine whether the user_cpus_ptr is taking effect, it is better to print the task's user_cpus_ptr. For top-cpuset: ums9621_1h10:/ # while true; do done& [1] 6786 ums9621_1h10:/ # cat /proc/6786/status | grep Cpus Cpus_allowed: ff Cpus_allowed_list: 0-7 Cpus_user_allowed: (null) Cpus_user_allowed_list: (null) bind the task to 6-7: ums9621_1h10:/ # taskset -p c0 6786 pid 6786's current affinity mask: ff pid 6786's new affinity mask: c0 ums9621_1h10:/ # cat /proc/6786/status | grep Cpus Cpus_allowed: c0 Cpus_allowed_list: 6-7 Cpus_user_allowed: c0 Cpus_user_allowed_list: 6-7 Offline cpu7: ums9621_1h10:/ # echo 0 > /sys/devices/system/cpu/cpu7/online ums9621_1h10:/ # cat /proc/6786/status | grep Cpus Cpus_allowed: c0 Cpus_allowed_list: 6-7 Cpus_user_allowed: c0 Cpus_user_allowed_list: 6-7 Offline cpu6, and then the do_set_cpus_allowed will clear the user_ptr: ums9621_1h10:/ # echo 0 > /sys/devices/system/cpu/cpu6/online ums9621_1h10:/ # cat /proc/6786/status | grep Cpus Cpus_allowed: ff Cpus_allowed_list: 0-7 Cpus_user_allowed: (null) Cpus_user_allowed_list: (null) Bringup the core6,7: ums9621_1h10:/ # echo 1 > /sys/devices/system/cpu/cpu6/online ums9621_1h10:/ # echo 1 > /sys/devices/system/cpu/cpu7/online ums9621_1h10:/ # cat /proc/6786/status | grep Cpus Cpus_allowed: ff Cpus_allowed_list: 0-7 Cpus_user_allowed: (null) Cpus_user_allowed_list: (null) Signed-off-by: Xuewen Yan --- fs/proc/array.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/proc/array.c b/fs/proc/array.c index 34a47fb0c57f..084bee2a2e2b 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -409,6 +409,10 @@ static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) cpumask_pr_args(&task->cpus_mask)); seq_printf(m, "Cpus_allowed_list:\t%*pbl\n", cpumask_pr_args(&task->cpus_mask)); + seq_printf(m, "Cpus_user_allowed:\t%*pb\n", + cpumask_pr_args(task->user_cpus_ptr)); + seq_printf(m, "Cpus_user_allowed_list:\t%*pbl\n", + cpumask_pr_args(task->user_cpus_ptr)); } static inline void task_core_dumping(struct seq_file *m, struct task_struct *task) -- 2.25.1