This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2b71a6c8503d26f8ea2d32046cc5a7893563f237
Author: Bowen Wang <[email protected]>
AuthorDate: Fri Nov 20 02:56:53 2026 +0800

    fs/procfs: show the affinity mask on the status CPU line
    
    The task status file shows the CPU a thread runs on, but not the set of
    CPUs it is allowed to run on.  Both are needed when a thread is pinned
    unexpectedly: a thread that keeps landing on the same CPU with a full
    affinity mask is a scheduling problem, not a pinning one.
    
    Print the mask next to the CPU index:
    
      CPU:         001(0x00000003)
      CPU:         ---(0x00000003)
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 fs/procfs/fs_procfsproc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c
index eb31134bcac..2887ee72a34 100644
--- a/fs/procfs/fs_procfsproc.c
+++ b/fs/procfs/fs_procfsproc.c
@@ -575,12 +575,14 @@ static ssize_t proc_status(FAR struct proc_file_s 
*procfile,
       tcb->task_state <= LAST_ASSIGNED_STATE)
     {
       linesize   = procfs_snprintf(procfile->line, STATUS_LINELEN,
-                                   "%-12s%d\n", "CPU:", tcb->cpu);
+                                   "%-12s%03d(0x%08" PRIx32 ")\n", "CPU:",
+                                   tcb->cpu, tcb->affinity);
     }
   else
     {
       linesize   = procfs_snprintf(procfile->line, STATUS_LINELEN,
-                                   "%-12s---\n", "CPU:");
+                                   "%-12s---(0x%08" PRIx32 ")\n", "CPU:",
+                                   tcb->affinity);
     }
 
   copysize   = procfs_memcpy(procfile->line, linesize, buffer, remaining,

Reply via email to