From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout06.his.huawei.com (canpmsgout06.his.huawei.com [113.46.200.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E33B6289367 for ; Sun, 4 Jan 2026 13:23:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.221 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767532999; cv=none; b=g4UgjQ82QEmKxn1/mhqZ8/UDS67YmjdUgVtlIu/4t9jcc4s32KHnIBSK7h8VLXFrNWpO+WG3eZvDZmWqwQzLjeSoSAhDfKfzSLcOxB+iys58TeLegf71u20Gaaz5mqLwju4awTqUyG5anvC5lzou7vSB7NlMg7N4UMY7inyYTqM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767532999; c=relaxed/simple; bh=IBqowi3xaDBpdlXgW6fN9BlejZqDENeJZ3j2EIuQmIA=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=WnuPpCRVw9mLR79dlyyFWjBqDH9cj5SElvuaJTZ2W5qt+GHrrehgi7IjJmLSndjJ56vg2+h/JxulDtW3MFAVbGuoxu3vkkH5kEycHLhVt0OTtXbHpmjmEJnZ87V6KlZU2thsjp94vl9DQT1cWIcurncuV2V0cReu3lpuzfkaITs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=1/5yRo9Q; arc=none smtp.client-ip=113.46.200.221 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="1/5yRo9Q" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=sx3tLbtjDVyBi6zMPcObU2OKett7UkJcshJ6FhUScIc=; b=1/5yRo9QgXsCK8btNoVqkUh+OzooUaciTb6zZ4SWsytSEnzkH3lqGOMzFiv6IIMOsrYX+OUPt 9P4GJ9CYob1yey4BkOZJX8LCMC+a/9tMwI/qy6txa+8BUjbAxlb+/r46X7cSclMUpMWPVpoOZYT Hf3ePP9GpiPfu9hUyvjUiQQ= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout06.his.huawei.com (SkyGuard) with ESMTPS id 4dkdMG6ZyyzRhRN; Sun, 4 Jan 2026 21:19:54 +0800 (CST) Received: from dggemv705-chm.china.huawei.com (unknown [10.3.19.32]) by mail.maildlp.com (Postfix) with ESMTPS id E2CE3404AD; Sun, 4 Jan 2026 21:23:08 +0800 (CST) Received: from kwepemn500008.china.huawei.com (7.202.194.149) by dggemv705-chm.china.huawei.com (10.3.19.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sun, 4 Jan 2026 21:23:08 +0800 Received: from [10.67.110.89] (10.67.110.89) by kwepemn500008.china.huawei.com (7.202.194.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sun, 4 Jan 2026 21:23:08 +0800 Message-ID: <518a5712-3348-4acd-ae26-529621143ef7@huawei.com> Date: Sun, 4 Jan 2026 21:23:07 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: =?UTF-8?B?UmU6IOetlOWkjTogWz8/Pz9dIFJlOiBkaXZpZGUgZXJyb3IgaW4geDg2?= =?UTF-8?Q?_and_cputime?= To: "Li,Rongqing" , Oleg Nesterov , Peter Zijlstra , David Laight CC: "linux-kernel@vger.kernel.org" , "vschneid@redhat.com" , "mgorman@suse.de" , "bsegall@google.com" , "rostedt@goodmis.org" , "dietmar.eggemann@arm.com" , "vincent.guittot@linaro.org" , "juri.lelli@redhat.com" , "mingo@redhat.com" , "Zhangqiao (2012 lab)" , Xia Fukun References: <78a0d7bb20504c0884d474868eccd858@baidu.com> <20250707220937.GA15787@redhat.com> <20250707223038.GB15787@redhat.com> <2ef88def90634827bac1874d90e0e329@baidu.com> Content-Language: en-US From: Xia Fukun In-Reply-To: <2ef88def90634827bac1874d90e0e329@baidu.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemn500008.china.huawei.com (7.202.194.149) On 7/8/2025 7:41 AM, Li,Rongqing wrote: > > it happened when a process with 236 busy polling threads , run about 904 days, the total time will overflow the 64bit > > non-x86 system maybe has same issue, once (stime + utime) overflows 64bit, mul_u64_u64_div_u64 from lib/math/div64.c maybe cause division by 0 > We have encountered the same issue in an environment with x86 architecture and kernel version 5.10. [48734536.498953] divide error: 0000 [#1] SMP NOPTI [48734536.504336] CPU: 273 PID: 4619 Comm: nano-sysmonitor Kdump: loaded Tainted: G OE 5.10.0-60.18.0.50.r1209_60_175.hce2.x86_64 #1 [48734536.518065] Hardware name: XFUSION 5885H V7/BC15MBHA, BIOS 01.02.01.03 01/01/2024 [48734536.526620] RIP: 0010:cputime_adjust+0x55/0xb0 [48734536.532093] Code: 0b 48 8b 7d 10 49 89 c0 48 8d 04 0e 48 39 f8 73 38 48 8b 45 00 48 8b 55 08 48 85 c0 74 16 48 85 d2 74 4d 4c 8d 0c 10 48 f7 e7 <49> f7 f1 48 39 c6 48 0f 42 f0 48 89 f8 48 29 f0 48 39 c1 77 29 48 [48734536.552057] RSP: 0018:ffffae408e07bbc8 EFLAGS: 00010807 [48734536.558328] RAX: 2facb95ea704eb6a RBX: ffff98b6293db180 RCX: fff9b822b886cabf [48734536.566529] RDX: 0005cf0f135b9489 RSI: 0005cf0ec21afa94 RDI: ffff93c922ae82ee [48734536.574727] RBP: ffffae408e07bbf8 R08: 0000000000000082 R09: 000007333e295d49 [48734536.582930] R10: 8000000000000000 R11: 0000000000000000 R12: ffffae408e07bcf8 [48734536.591131] R13: ffffae408e07bcf0 R14: ffff98b6293db190 R15: fffa2e80e26a98fd [48734536.599334] FS: 00007f0bc58c3740(0000) GS:ffff98bb75040000(0000) knlGS:0000000000000000 [48734536.608498] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [48734536.615294] CR2: 0000557c0ddca1c8 CR3: 00000600ae12a002 CR4: 0000000000372ee0 [48734536.623497] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [48734536.631697] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 [48734536.639898] Call Trace: [48734536.712624] thread_group_cputime_adjusted+0x4b/0x70 [48734536.718634] do_task_stat+0x2d8/0xdc0 [48734536.723326] task_info_proc_get_info+0x133/0x150 Specifically, a division error occurs in cputime_adjust() during the following calculation: mul_u64_u64_div_u64(0x5cf1187f5ad33, 0xffff93c922ae82ee, 0x7333e295d49) Is the patch provided here feasible? Or are there any known workarounds? > so to cputime, could cputime_adjust() return stime if stime if stime + utime is overflow > > diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c > index 6dab4854..db0c273 100644 > --- a/kernel/sched/cputime.c > +++ b/kernel/sched/cputime.c > @@ -579,6 +579,10 @@ void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev, > goto update; > } > > + if (stime > (stime + utime)) { > + goto update; > + } > + > stime = mul_u64_u64_div_u64(stime, rtime, stime + utime); > /* > * Because mul_u64_u64_div_u64() can approximate on some >