From: Junwen Wu <wudaemon@163.com>
To: rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org,
rui.zhang@intel.com
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Junwen Wu <wudaemon@163.com>
Subject: [PATCH v1] thermal/core: change mm alloc method to avoid kernel warning
Date: Sun, 17 Apr 2022 12:56:01 +0000 [thread overview]
Message-ID: <20220417125601.18535-1-wudaemon@163.com> (raw)
Very high cooling device max state value makes cooling device stats
buffer allocation fails,like below.Using kzvalloc instead of kzalloc
can avoid this issue.
[ 7.392644]WARNING: CPU: 7 PID: 1747 at mm/page_alloc.c:5090 __alloc_pages_nodemask+0x1c0/0x3dc
[ 7.392989]Call trace:
[ 7.392992]__alloc_pages_nodemask+0x1c0/0x3dc
[ 7.392995]kmalloc_order+0x54/0x358
[ 7.392997]kmalloc_order_trace+0x34/0x1bc
[ 7.393001]__kmalloc+0x5cc/0x9c8
[ 7.393005]thermal_cooling_device_setup_sysfs+0x90/0x218
[ 7.393008]__thermal_cooling_device_register+0x160/0x7a4
[ 7.393012]thermal_of_cooling_device_register+0x14/0x24
[ 7.393140]backlight_cdev_register+0x88/0x100 [msm_drm]
Signed-off-by: Junwen Wu <wudaemon@163.com>
---
drivers/thermal/thermal_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index f154bada2906..361e0d0c241b 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -829,7 +829,7 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
var += sizeof(*stats->time_in_state) * states;
var += sizeof(*stats->trans_table) * states * states;
- stats = kzalloc(var, GFP_KERNEL);
+ stats = kvzalloc(var, GFP_KERNEL);
if (!stats)
return;
@@ -848,7 +848,7 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
static void cooling_device_stats_destroy(struct thermal_cooling_device *cdev)
{
- kfree(cdev->stats);
+ kvfree(cdev->stats);
cdev->stats = NULL;
}
--
2.25.1
next reply other threads:[~2022-04-17 13:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-17 12:56 Junwen Wu [this message]
2022-04-19 8:48 ` [PATCH v1] thermal/core: change mm alloc method to avoid kernel warning Zhang Rui
2022-04-19 9:14 ` Daniel Lezcano
2022-04-19 13:54 ` Zhang Rui
2022-04-19 17:56 ` Daniel Lezcano
2022-05-08 15:07 ` Junwen Wu
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=20220417125601.18535-1-wudaemon@163.com \
--to=wudaemon@163.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/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