[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CU5EUJDXM616.SQKBEGB2RLHL@suppilovahvero>
Date: Tue, 18 Jul 2023 18:41:27 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Tejun Heo" <tj@...nel.org>,
"Haitao Huang" <haitao.huang@...ux.intel.com>
Cc: <dave.hansen@...ux.intel.com>, <linux-kernel@...r.kernel.org>,
<linux-sgx@...r.kernel.org>, <cgroups@...r.kernel.org>,
"Zefan Li" <lizefan.x@...edance.com>,
"Johannes Weiner" <hannes@...xchg.org>, <vipinsh@...gle.com>,
<kai.huang@...el.com>, <reinette.chatre@...el.com>,
<zhiquan1.li@...el.com>, <kristen@...ux.intel.com>
Subject: Re: [PATCH] cgroup/misc: Fix an overflow
On Mon Jul 17, 2023 at 11:37 PM EEST, Tejun Heo wrote:
> 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.
In our context, the microcode of SGX could support 32-bit but by design
we only support 64-bit. So at least with the current implementation this
would not be an issue for SGX.
BR, Jarkko
Powered by blists - more mailing lists