linux: Ensure count is 64bits aligned for proper atomic use on 32bits machines

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-10-11 10:01:01 -07:00
parent 7f4f4b5e68
commit d8e489443c
No known key found for this signature in database
GPG Key ID: 40CF16616B361216

View File

@ -44,11 +44,14 @@ type oomCollector struct {
} }
type oom struct { type oom struct {
// count needs to stay the first member of this struct to ensure 64bits
// alignment on a 32bits machine (e.g. arm32). This is necessary as we use
// the sync/atomic operations on this field.
count int64
id string id string
namespace string namespace string
c cgroups.Cgroup c cgroups.Cgroup
triggers []Trigger triggers []Trigger
count int64
} }
func (o *oomCollector) Add(id, namespace string, cg cgroups.Cgroup, triggers ...Trigger) error { func (o *oomCollector) Add(id, namespace string, cg cgroups.Cgroup, triggers ...Trigger) error {