From patchwork Thu Sep 26 23:19:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6auY57+U?= X-Patchwork-Id: 13813726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D620CEBF61 for ; Thu, 26 Sep 2024 23:19:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 181F36B009F; Thu, 26 Sep 2024 19:19:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0BC906B00A1; Thu, 26 Sep 2024 19:19:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9EF76B00A2; Thu, 26 Sep 2024 19:19:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C201C6B009F for ; Thu, 26 Sep 2024 19:19:34 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2A3871C5334 for ; Thu, 26 Sep 2024 23:19:34 +0000 (UTC) X-FDA: 82608458268.19.7D561F9 Received: from outboundhk.mxmail.xiaomi.com (outboundhk.mxmail.xiaomi.com [207.226.244.122]) by imf09.hostedemail.com (Postfix) with ESMTP id 87173140008 for ; Thu, 26 Sep 2024 23:19:30 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=xiaomi.com; spf=pass (imf09.hostedemail.com: domain of gaoxiang17@xiaomi.com designates 207.226.244.122 as permitted sender) smtp.mailfrom=gaoxiang17@xiaomi.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727392755; a=rsa-sha256; cv=none; b=U249oigAqVMbE/1blZvOw6MKQtTcfgMqXd4uFQVRhzfxr6chiXJzACei5c1oHm4EKHWNY4 p9LipC5ZMmpAtD8yhtR8cNgnvCABecwCcrxa1nsjr+gtyuv4b1eUvto8CCcV4iPqFC+BkK KwD9cRwzkoTIMnulJsyJRnmcnPicQOk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=xiaomi.com; spf=pass (imf09.hostedemail.com: domain of gaoxiang17@xiaomi.com designates 207.226.244.122 as permitted sender) smtp.mailfrom=gaoxiang17@xiaomi.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727392755; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PCfQLvKxVnKmnVKZbw4O8ccKwuznq75guq41sMxy4x4=; b=HhZ4Gn8oLKRZ59czEeEStKO3BvHTlFWiXW+VBFXeYTQJk3kDjqt3lOSNajYC3i0XLvMAVS mVFrR2oxyF2baHHMtBGW+lasxHBr1a8UmfXDIxkQpy8bShbfVZQ1P8V6neGJrtBX/5JYvL u3jU5qCzvAhD6clyZ/9dkzAEpMUXgmQ= X-CSE-ConnectionGUID: DN+VhvVQS96cqvjlitkLUQ== X-CSE-MsgGUID: HR5jEaO2Qnix9+spZ0O3dg== X-IronPort-AV: E=Sophos;i="6.11,156,1725292800"; d="scan'208,217";a="123158771" From: =?eucgb2312_cn?b?uN/P6A==?= To: Andrew Morton , "mm-commits@vger.kernel.org" CC: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "david@redhat.com" Subject: =?eucgb2312_cn?b?tPC4tDogW0V4dGVybmFsIE1haWxdKyBtbS1jbWEtcHJpbnQtdG90YWwt?= =?eucgb2312_cn?b?YW5kLXVzZWQtY291bnQtaW4tY21hX2FsbG9jLnBhdGNoIGFkZGVkIHRvIG1tLXVu?= =?eucgb2312_cn?b?c3RhYmxlIGJyYW5jaA==?= Thread-Topic: [External Mail]+ mm-cma-print-total-and-used-count-in-cma_alloc.patch added to mm-unstable branch Thread-Index: AQHbEFJEipCcHgjlfkmwJNEBGIkkx7Jqs0EM Date: Thu, 26 Sep 2024 23:19:25 +0000 Message-ID: References: <20240926202540.E47E3C4CEC7@smtp.kernel.org> In-Reply-To: <20240926202540.E47E3C4CEC7@smtp.kernel.org> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.237.8.11] MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: obrz51aaitjk64aj9d4ke7wc43acup5q X-Rspamd-Queue-Id: 87173140008 X-Rspamd-Server: rspam02 X-HE-Tag: 1727392770-635491 X-HE-Meta: U2FsdGVkX1/HRRQ+4YvBCw+SwBnoZPaLot3Oc1w2KOvDAyfkAhebQelmqEBB7eDt4EppnuGa8VmoOTqrMK3b2CGd4O5eTrRyMdTYsE6fx92rAEekf8lkvxKXrXFbPgadE3KE9pN3lNKrFrPfPOsVgUZGpn4qObg7ZJNMe/co+1l9wqTQ7ehiPkNAD1MGQj4JoYC/kNvlqOPzPY/qJCV2AhsKM8iwoJXpY7Umg68H6dmWBGVsDj97DxzNoi12i3rNY3iKQ9PomvV8Awbkt5UuXqYAnjlveWnLttaEu2MGB/IKRcaI49+bgXybksU9xgShhvN9VL3AkwJzajJHK8VfXOLsVav4fEfR4eIn6cpr46DscWW30QN6/2IYxeuMMLrr3dvvLEoejcG04jSyoeGww+pcCEbbjSNah8G9K3aHAzt7Eo8WJM55DilpapcWPPaDf33UERsfSTghkAG25iQ3nbfglTh3BaiHiLnyeZN0XkUskm8qGHN5+lnO35hDrzsZftJSQHMtUVIZ0+8fBTtHotdMTYnfBc8tq3MQxrHbUa3XwKrdL8ApOwBDDqcRkHEhqieazhgICktWw/zDttuy0rmn7hgLBFvbxYsruzGCo7B/K42lRFQsZZd5YkrTJg9IoeaUQBjwVjPloVd1HsxeYQqMeaCuy3ZWyBsfmK1FG9rmh/ermyPsb5dy7VdWWTVjSz/UwYdpPQ+/DwQQ/31BJTH0DBB43xxldSBPZEyJ5hsWuQJ/rcXeLjgREFJIIVHPUY1ildGiAW7fpglp4GHuRsdQGUiirIGOQMrU2n+8XSaKzaUV2zZNQLFyRzY5rrHOaAYxO3NmMZhivEK0c5Uq1JwqeGKP9J+EtDI8rsrJoSwfBIV/da0weLzQty7tByKUnhDyRne8ieb8BxYnDYPhio59QejnaD4suORihSXzOFkKLKGdj7z42CPTuiPVl18TZkAQt4cf2ueu0o7whWG IH+tCOGn tWUFSV5UE2UNaoHO5zjvW380EJlYR6s5COHvIVlFRKBJI31sW8qwPInIgf90NukXJBUGpq8tOfy1ehNIke2JRoeOs6ul31Z3STER7hJjEtr6GfqVbRo80M87DK3v5d6nWO47hGEr9dCfzwx6I5IoRgwD6/Vr9c/m6Rij2Gut05qo7sKWGHI7tSXJZkVdQyBzTiL0JL/duqUXAOUBXe2HGNNwTWteomciU9ioncXXGmSMxZRC5y0TShP4ughOOzimfoKw/mFn2Ihu1sGdNSJaEpprPzB05spsK7eG9WYJ1HmmpQj7djehB8k5J6UJRa1eAJx5Dcz1UC5uohDs6tcp1LyjMBX6sl154xugQIr+0EWGdaBx8lD3gTivn0aeTj/VdC5nwxNi829sfjAv4jPNkUYkctS1wlYbtqrzPOw3LyYlm5BXH19wnHXJSaeOqHC+1EXVAy9QyW6W9++6drWiHsVAeJ0DqR5VvFzGOLJGSgzsNR1kBxR+gygcAoyqkyOqzI7F4jWAEhu3HvrYApASZQVqSUpmmtCemP3mG X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: So now we're ready to merge into master? --- a/mm/cma.c~mm-cma-print-total-and-used-count-in-cma_alloc +++ a/mm/cma.c @@ -403,6 +403,17 @@ static void cma_debug_show_areas(struct spin_unlock_irq(&cma->lock); } +static unsigned long cma_get_used(struct cma *cma) +{ + unsigned long used; + + spin_lock_irq(&cma->lock); + used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma)); + spin_unlock_irq(&cma->lock); + + return used << cma->order_per_bit; +} + static struct page *__cma_alloc(struct cma *cma, unsigned long count, unsigned int align, gfp_t gfp) { @@ -420,8 +431,8 @@ static struct page *__cma_alloc(struct c if (!cma || !cma->count || !cma->bitmap) return page; - pr_debug("%s(cma %p, name: %s, count %lu, align %d)\n", __func__, - (void *)cma, cma->name, count, align); + pr_debug("%s(cma %p, name: %s, total count %lu, used count: %lu, request count %lu, align %d)\n", __func__, + (void *)cma, cma->name, cma->count, cma_get_used(cma), count, align); if (!count) return page;