From: Tejun Heo <tj@kernel.org>
To: Haitao Huang <haitao.huang@linux.intel.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>,
dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org,
linux-sgx@vger.kernel.org, cgroups@vger.kernel.org,
Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>,
vipinsh@google.com, kai.huang@intel.com,
reinette.chatre@intel.com, zhiquan1.li@intel.com,
kristen@linux.intel.com
Subject: Re: [PATCH] cgroup/misc: Fix an overflow
Date: Mon, 17 Jul 2023 10:37:08 -1000 [thread overview]
Message-ID: <ZLWmdBfcuPUBtk1K@slm.duckdns.org> (raw)
In-Reply-To: <op.178te0tbwjvjmi@hhuan26-mobl.amr.corp.intel.com>
Hello,
On Mon, Jul 17, 2023 at 03:19:38PM -0500, Haitao Huang wrote:
> Actually, we are using atomic_long_t for 'current' which is the same width
> as long defined by arch/compiler. So new_usage should be long to be
> consistent?
We can use atomic64_t, right? It's slower on 32bit machines but I think it'd
be better to guarantee resource counter range than micro-optimizing charge
operations. None of the current users are hot enough for this to matter and
if somebody becomes that hot, the difference between atomic_t and atomic64_t
isn't gonna matter that much. We'd need to batch allocations per-cpu and so
on.
> ditto for event counter. Only max is plain unsigned long but I think it is
> also OK as it only compared with 'current' without any arithmetic ops
> involved.
> Did I miss something here?
I'm saying that it'd be better to make everything explicitly 64bit.
Thanks.
--
tejun
next prev parent reply other threads:[~2023-07-17 20:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 18:47 [PATCH] cgroup/misc: Fix an overflow Haitao Huang
[not found] ` <20230717184719.85523-1-haitao.huang-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2023-07-17 18:51 ` Tejun Heo
2023-07-17 18:55 ` Jarkko Sakkinen
2023-07-17 18:57 ` Tejun Heo
[not found] ` <ZLWPN_xyGFrqqJkV-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-07-17 19:01 ` Haitao Huang
[not found] ` <op.178pr1qewjvjmi-yDQzE4XY+yVaPPhiJ6yCxLKMmGWinSIL2HeeBUIffwg@public.gmane.org>
2023-07-17 20:19 ` Haitao Huang
2023-07-17 20:37 ` Tejun Heo [this message]
2023-07-18 1:08 ` [PATCH 1/2] " Haitao Huang
[not found] ` <20230718010845.35197-1-haitao.huang-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2023-07-18 1:08 ` [PATCH 2/2] cgroup/misc: Change counters to be explicit 64bit types Haitao Huang
[not found] ` <20230718010845.35197-2-haitao.huang-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2023-07-18 22:52 ` Tejun Heo
[not found] ` <ZLcXmvDKheCRYOjG-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-07-21 2:48 ` Haitao Huang
2023-07-21 12:02 ` [PATCH] cgroup/misc: Store atomic64_t reads to u64 Haitao Huang
[not found] ` <20230721120231.13916-1-haitao.huang-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2023-07-21 18:10 ` Tejun Heo
[not found] ` <ZLWmdBfcuPUBtk1K-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-07-18 1:11 ` [PATCH] cgroup/misc: Fix an overflow Haitao Huang
2023-07-18 15:41 ` Jarkko Sakkinen
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=ZLWmdBfcuPUBtk1K@slm.duckdns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=haitao.huang@linux.intel.com \
--cc=hannes@cmpxchg.org \
--cc=jarkko@kernel.org \
--cc=kai.huang@intel.com \
--cc=kristen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=reinette.chatre@intel.com \
--cc=vipinsh@google.com \
--cc=zhiquan1.li@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