linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Kieran Bingham <kbingham@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	casper.li@mediatek.com, chinwen.chang@mediatek.com,
	qun-wei.lin@mediatek.com, linux-mm@kvack.org,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 1/3] scripts/gdb/tasks: Fix lx-ps command error
Date: Mon, 27 Nov 2023 13:03:14 +0100	[thread overview]
Message-ID: <20231127120314.GA19669@redhat.com> (raw)
In-Reply-To: <20231127070404.4192-2-Kuan-Ying.Lee@mediatek.com>

On 11/27, Kuan-Ying Lee wrote:
>
> @@ -25,13 +25,9 @@ def task_lists():
>      t = g = init_task
>  
>      while True:
> -        while True:
> -            yield t
> -
> -            t = utils.container_of(t['thread_group']['next'],
> -                                   task_ptr_type, "thread_group")
> -            if t == g:
> -                break
> +        thread_head = t['signal']['thread_head']
> +        for thread in lists.list_for_each_entry(thread_head, task_ptr_type, 'thread_node'):
> +            yield thread
>  
>          t = g = utils.container_of(g['tasks']['next'],
>                                     task_ptr_type, "tasks")

Thanks!

I do not know python, but it seems that with this patch we can kill g or t?
Can't

	def task_lists():
	    task_ptr_type = task_type.get_type().pointer()
	    init_task = gdb.parse_and_eval("init_task").address
	    t = init_task

	    while True:
		thread_head = t['signal']['thread_head']
		for thread in lists.list_for_each_entry(thread_head, task_ptr_type, 'thread_node'):
		    yield thread

		t = utils.container_of(t['tasks']['next'],
				       task_ptr_type, "tasks")
		if t == init_task:
		    return

work?

Oleg.



  reply	other threads:[~2023-11-27 12:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27  7:04 [PATCH 0/3] Fix GDB commands error Kuan-Ying Lee
2023-11-27  7:04 ` [PATCH 1/3] scripts/gdb/tasks: Fix lx-ps command error Kuan-Ying Lee
2023-11-27 12:03   ` Oleg Nesterov [this message]
2023-11-28 11:45     ` Kuan-Ying Lee (李冠穎)
2023-11-27  7:04 ` [PATCH 2/3] scripts/gdb/stackdepot: Rename pool_index_cached to pools_num Kuan-Ying Lee
2023-11-27  7:04 ` [PATCH 3/3] scripts/gdb: Remove exception handling and refine print format Kuan-Ying Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231127120314.GA19669@redhat.com \
    --to=oleg@redhat.com \
    --cc=Kuan-Ying.Lee@mediatek.com \
    --cc=akpm@linux-foundation.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=casper.li@mediatek.com \
    --cc=chinwen.chang@mediatek.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kbingham@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=matthias.bgg@gmail.com \
    --cc=qun-wei.lin@mediatek.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).