Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2980915rdh; Mon, 27 Nov 2023 04:04:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqarl+/Zrbb9LslHkYhRpO5HnV49YmpUHKzuZuf87sdYJVKetw115B0DBI8y2RCnnbjapp X-Received: by 2002:a9d:7452:0:b0:6d8:1c20:85c3 with SMTP id p18-20020a9d7452000000b006d81c2085c3mr5794630otk.20.1701086682444; Mon, 27 Nov 2023 04:04:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701086682; cv=none; d=google.com; s=arc-20160816; b=PZC6WemmU46kuxm6C4XtyMFNfieHwfTOxXpBCb8nYXZMmcMqRguU3eNyFqGhZTKHqk vRmDRF3pAibJazlt+8wqxTrV9nt23guoD+BxwG6rmUXajBQp+v1uTlJiiqYG4Fn0NcXR 45hphRFYTjCd1QWnLDIviFzsrH/gjoVCB38RyUtKHG7oC+LY9xJM/8wXCti/Z4vqFdAQ j/hxAy9WHWHNPPb6fktyxe05utwnWCvyfY5Th2Js0Kgs6StzX8u1EhWuxwWFpeplhDRL gmiJepYbostMX8r5q9RbWUp6F4IsqU0IMT9IQVFcqJAc4J1iddJwVE3696unE9iIPotT C0yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=KWNuo6JI/OYsTU4e3seiEKnPSTG4IX85SKhKR7+RBiE=; fh=jShKQAplIBCWeEP6OJBlCM21jMiJ4IVxwWjs7m9Dalo=; b=L5j8GD4pJVaEtQov/Pg3e/EJjrWC+Q2/pO9gN90dH8h+TFIwGRi6sU3s86cw4/hBNN O/Lp93BmSqonhHsy9xpXtzAW6dAZmYRKhl6TpbPmkhQECQrwKgx38MOF2Vl54wYZyQHQ rXSgntD40WeDJ73CzFllAylmcHWQDiXlPOysXyLaU9bi4F3G+sPd4ZcahvPUlYqX0+Z/ k/RYP7PdYZUPfbKGbQQstyfrPkmb4+VwQX4DZQ2xzzv908tl0un2mQA14q7jrU/QP+9e qLzcV98REtEtbOHPRpxy4/aWdzYQcqmL6b3WBPhdKo70tJcqj2mFN4H1FaXR/ILtOXI4 j0rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JMYuadUz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id y10-20020a0568301d8a00b006ce2b8f38eesi3495974oti.2.2023.11.27.04.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 04:04:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JMYuadUz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 35B4380AF256; Mon, 27 Nov 2023 04:04:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233070AbjK0MEZ (ORCPT + 99 others); Mon, 27 Nov 2023 07:04:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbjK0MEY (ORCPT ); Mon, 27 Nov 2023 07:04:24 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C257EE6 for ; Mon, 27 Nov 2023 04:04:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701086669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KWNuo6JI/OYsTU4e3seiEKnPSTG4IX85SKhKR7+RBiE=; b=JMYuadUz3FqM4x0r1yXCsWhzdAdXzVjNY4D8D21nxlkFgznlkbNgajTXBZHlZvGN6hx4fu UX+cC7Ih6ap81m2cnCMq2KlbzkMm/BAagHOMbUDTgMWvEd12tPXCtCACc01pCtOw8Q6OKy b0TtIyOAoLCRg6zCeon9jp8NY1djnDI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-609-nDYczEEeP4yMToRKl1A7GQ-1; Mon, 27 Nov 2023 07:04:24 -0500 X-MC-Unique: nDYczEEeP4yMToRKl1A7GQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 B767085C1A0; Mon, 27 Nov 2023 12:04:23 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.14]) by smtp.corp.redhat.com (Postfix) with SMTP id 731645028; Mon, 27 Nov 2023 12:04:20 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 27 Nov 2023 13:03:18 +0100 (CET) Date: Mon, 27 Nov 2023 13:03:14 +0100 From: Oleg Nesterov To: Kuan-Ying Lee Cc: Jan Kiszka , Kieran Bingham , Matthias Brugger , AngeloGioacchino Del Regno , Andrew Morton , 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 Message-ID: <20231127120314.GA19669@redhat.com> References: <20231127070404.4192-1-Kuan-Ying.Lee@mediatek.com> <20231127070404.4192-2-Kuan-Ying.Lee@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231127070404.4192-2-Kuan-Ying.Lee@mediatek.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 04:04:39 -0800 (PST) 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.