lkml.org 
[lkml]   [2022]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/3] mm: page_counter: rearrange struct page_counter fields
    On Mon 22-08-22 08:06:14, Shakeel Butt wrote:
    [...]
    > > > struct page_counter {
    > > > + /*
    > > > + * Make sure 'usage' does not share cacheline with any other field. The
    > > > + * memcg->memory.usage is a hot member of struct mem_cgroup.
    > > > + */
    > > > + PC_PADDING(_pad1_);
    > >
    > > Why don't you simply require alignment for the structure?
    >
    > I don't just want the alignment of the structure. I want different
    > fields of this structure to not share the cache line. More
    > specifically the 'high' and 'usage' fields. With this change the usage
    > will be its own cache line, the read-most fields will be on separate
    > cache line and the fields which sometimes get updated on charge path
    > based on some condition will be a different cache line from the
    > previous two.

    I do not follow. If you make an explicit requirement for the structure
    alignement then the first field in the structure will be guarantied to
    have that alignement and you achieve the rest to be in the other cache
    line by adding padding behind that.

    --
    Michal Hocko
    SUSE Labs

    \
     
     \ /
      Last update: 2022-08-22 17:23    [W:2.124 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site