Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1636220pxb; Mon, 13 Sep 2021 02:00:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTUCK17LlpPy7+WwpgPYe22fsdx1rOFqzGFAVFAY8bZOgCL4hMj2ljZMrdwoWRm3NeLCsx X-Received: by 2002:a92:730c:: with SMTP id o12mr7323455ilc.208.1631523634935; Mon, 13 Sep 2021 02:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631523634; cv=none; d=google.com; s=arc-20160816; b=lvSBQb4rULgFNfMgN+q/YwQ2bIYS03vXqn7wPlmjMPoJ3kosX4oO1sz105XyFlvmbO frRc3Np5JzKx+OHoHzol1+CwYxQ4gYbjTqoF29wb3ZapyXZ12gM1R0IbFvpvJf/O/V55 a5RfvT6q2lBjvt1fAixb5DeTYG+Yw4aSZVsxXa85GrhR6xqKuVzvB07J2POO8OkHWt4M SIetNLESClz99sQYuiFY6QGKacfzjORePGibtPakIbclYS01HBejMlOjkM0UG6CJZ/k7 2ulC6duFt5Py28XdEPZSi1cUUkk9eeyoLWiSqRi0cN2M8C2bTvkuEgZsN7kjwv2wekEP fO2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=TSCXp582JCB93pDcXqjCq4eYgGqnmvRoH7Bix+DCWrU=; b=XOjnclC/SxFG1V1GRVCjZU29ulSH0Ax1Wo7j6IDNA3uXS99nSLvjUgInYNJR9bVI08 z6PDfUweOVCUJv/zb69j7iraPwRqDP2tYhUfPHh5EiHxu+fUbVJuon9SS0PHjqfiCvkw RQI3mw3+njpDYcZWJ57atQtHj9NQ8OtKyIHjCRU/G/IJCfMq6fqaNT/SLlvgUoHZw0YU gdDik+f5ndOQxf6rxXg+fVYqSilIyFykvkLjZRhbVzeagzhGH42fBqyKNqSLjyFlowcW BNTCNKlvAYU7W/4CR1anHcHlxmSqBcjBUgkL3w/47EeS3dDp7jMoUzQDMWMF4a7+M4FR Z/og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si6450981iot.102.2021.09.13.02.00.17; Mon, 13 Sep 2021 02:00:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238318AbhIMI6w (ORCPT + 99 others); Mon, 13 Sep 2021 04:58:52 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:9422 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238275AbhIMI6v (ORCPT ); Mon, 13 Sep 2021 04:58:51 -0400 Received: from dggeme762-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4H7Kxx3wWLz8ySk; Mon, 13 Sep 2021 16:53:09 +0800 (CST) Received: from dggeme759-chm.china.huawei.com (10.3.19.105) by dggeme762-chm.china.huawei.com (10.3.19.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Mon, 13 Sep 2021 16:57:34 +0800 Received: from dggeme759-chm.china.huawei.com ([10.8.81.151]) by dggeme759-chm.china.huawei.com ([10.8.81.151]) with mapi id 15.01.2308.008; Mon, 13 Sep 2021 16:57:34 +0800 From: weizhenliang To: Andrew Morton CC: "tangbin@cmss.chinamobile.com" , "zhangshengju@cmss.chinamobile.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Nixiaoming , "Xiaoqian (xiaoqian, RTOS FAE)" Subject: =?gb2312?B?tPC4tDogW1BBVENIXSB0b29scy92bS9wYWdlX293bmVyX3NvcnQuYzogY291?= =?gb2312?Q?nt_and_sort_by_mem?= Thread-Topic: [PATCH] tools/vm/page_owner_sort.c: count and sort by mem Thread-Index: AQHXpfB+f0OYJ3BhKEyklvTUrbLdJKue5dEAgALIGWA= Date: Mon, 13 Sep 2021 08:57:33 +0000 Message-ID: <7912a2a7dc5544509d96541dad2dde06@huawei.com> References: <1631243023-47849-1-git-send-email-weizhenliang@huawei.com> <20210911152520.45d6e3ed690b652a4d49a1c0@linux-foundation.org> In-Reply-To: <20210911152520.45d6e3ed690b652a4d49a1c0@linux-foundation.org> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.101.97] Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org T24gRnJpLCAxMiBTZXAgMjAyMSBBbmRyZXcgTW9ydG9uIHdyb3RlOg0KDQo+T24gRnJpLCAxMCBT ZXAgMjAyMSAxMTowMzo0MyArMDgwMCBaaGVubGlhbmcgV2VpIDx3ZWl6aGVubGlhbmdAaHVhd2Vp LmNvbT4gd3JvdGU6DQo+DQo+PiBXaGVuIHZpZXdpbmcgcGFnZSBvd25lciBpbmZvcm1hdGlvbiwg d2UgbWF5IGJlIG1vcmUgY29uY2VybmVkIGFib3V0IA0KPj4gdGhlIHRvdGFsIG1lbW9yeSB0aGFu IHRoZSBudW1iZXIgb2Ygc3RhY2sgb2NjdXJyZW5jZ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