<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/mm/percpu.c, branch v6.6-rc2</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>mm/percpu.c: print error message too if atomic alloc failed</title>
<updated>2023-08-25T15:04:59+00:00</updated>
<author>
<name>Baoquan He</name>
<email>bhe@redhat.com</email>
</author>
<published>2023-07-28T03:02:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f7d77dfc91f747f64cb00884fd6d7940c3b49fca'/>
<id>f7d77dfc91f747f64cb00884fd6d7940c3b49fca</id>
<content type='text'>
The variable 'err' is assgigned to an error message if atomic alloc
failed, while it has no chance to be printed if is_atomic is true.

Here change to print error message too if atomic alloc failed, while
avoid to call dump_stack() if that case.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The variable 'err' is assgigned to an error message if atomic alloc
failed, while it has no chance to be printed if is_atomic is true.

Here change to print error message too if atomic alloc failed, while
avoid to call dump_stack() if that case.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm/percpu.c: optimize the code in pcpu_setup_first_chunk() a little bit</title>
<updated>2023-08-25T15:04:59+00:00</updated>
<author>
<name>Baoquan He</name>
<email>bhe@redhat.com</email>
</author>
<published>2023-07-22T01:14:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=7ee1e758bebe13d96217bcfd5230892ed44760e7'/>
<id>7ee1e758bebe13d96217bcfd5230892ed44760e7</id>
<content type='text'>
This removes the need of local varibale 'chunk', and optimize the code
calling pcpu_alloc_first_chunk() to initialize reserved chunk and
dynamic chunk to make it simpler.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
[Dennis: reworded first chunk init comment]
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This removes the need of local varibale 'chunk', and optimize the code
calling pcpu_alloc_first_chunk() to initialize reserved chunk and
dynamic chunk to make it simpler.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
[Dennis: reworded first chunk init comment]
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm/percpu.c: remove redundant check</title>
<updated>2023-08-25T15:04:59+00:00</updated>
<author>
<name>Baoquan He</name>
<email>bhe@redhat.com</email>
</author>
<published>2023-07-21T13:17:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5b672085e70c2ea40f4c9d6a23848079bf0ff700'/>
<id>5b672085e70c2ea40f4c9d6a23848079bf0ff700</id>
<content type='text'>
The conditional check "(ai-&gt;dyn_size &lt; PERCPU_DYNAMIC_EARLY_SIZE) has
covered the check '(!ai-&gt;dyn_size)'.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The conditional check "(ai-&gt;dyn_size &lt; PERCPU_DYNAMIC_EARLY_SIZE) has
covered the check '(!ai-&gt;dyn_size)'.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm/percpu: Remove some local variables in pcpu_populate_pte</title>
<updated>2023-08-25T15:04:59+00:00</updated>
<author>
<name>Bibo Mao</name>
<email>maobibo@loongson.cn</email>
</author>
<published>2023-07-12T03:16:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=41fd59b7f9bdde2a473450680411c2016017b992'/>
<id>41fd59b7f9bdde2a473450680411c2016017b992</id>
<content type='text'>
In function pcpu_populate_pte there are already variable defined,
it can be reused for later use, here remove duplicated local
variables.

Signed-off-by: Bibo Mao &lt;maobibo@loongson.cn&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In function pcpu_populate_pte there are already variable defined,
it can be reused for later use, here remove duplicated local
variables.

Signed-off-by: Bibo Mao &lt;maobibo@loongson.cn&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm: memcontrol: rename memcg_kmem_enabled()</title>
<updated>2023-02-17T04:43:56+00:00</updated>
<author>
<name>Roman Gushchin</name>
<email>roman.gushchin@linux.dev</email>
</author>
<published>2023-02-13T19:29:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f7a449f779608efe1941a0e0c4bd7b5f57000be7'/>
<id>f7a449f779608efe1941a0e0c4bd7b5f57000be7</id>
<content type='text'>
Currently there are two kmem-related helper functions with a confusing
semantics: memcg_kmem_enabled() and mem_cgroup_kmem_disabled().

The problem is that an obvious expectation
memcg_kmem_enabled() == !mem_cgroup_kmem_disabled(),
can be false.

mem_cgroup_kmem_disabled() is similar to mem_cgroup_disabled(): it returns
true only if CONFIG_MEMCG_KMEM is not set or the kmem accounting is
disabled using a boot time kernel option "cgroup.memory=nokmem".  It never
changes the value dynamically.

memcg_kmem_enabled() is different: it always returns false until the first
non-root memory cgroup will get online (assuming the kernel memory
accounting is enabled).  It's goal is to improve the performance on
systems without the cgroupfs mounted/memory controller enabled or on the
systems with only the root memory cgroup.

To make things more obvious and avoid potential bugs, let's rename
memcg_kmem_enabled() to memcg_kmem_online().

Link: https://lkml.kernel.org/r/20230213192922.1146370-1-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin &lt;roman.gushchin@linux.dev&gt;
Acked-by: Muchun Song &lt;songmuchun@bytedance.com&gt;
Acked-by: Michal Hocko &lt;mhocko@suse.com&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: Shakeel Butt &lt;shakeelb@google.com&gt;
Cc: Dennis Zhou &lt;dennis@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently there are two kmem-related helper functions with a confusing
semantics: memcg_kmem_enabled() and mem_cgroup_kmem_disabled().

The problem is that an obvious expectation
memcg_kmem_enabled() == !mem_cgroup_kmem_disabled(),
can be false.

mem_cgroup_kmem_disabled() is similar to mem_cgroup_disabled(): it returns
true only if CONFIG_MEMCG_KMEM is not set or the kmem accounting is
disabled using a boot time kernel option "cgroup.memory=nokmem".  It never
changes the value dynamically.

memcg_kmem_enabled() is different: it always returns false until the first
non-root memory cgroup will get online (assuming the kernel memory
accounting is enabled).  It's goal is to improve the performance on
systems without the cgroupfs mounted/memory controller enabled or on the
systems with only the root memory cgroup.

To make things more obvious and avoid potential bugs, let's rename
memcg_kmem_enabled() to memcg_kmem_online().

Link: https://lkml.kernel.org/r/20230213192922.1146370-1-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin &lt;roman.gushchin@linux.dev&gt;
Acked-by: Muchun Song &lt;songmuchun@bytedance.com&gt;
Acked-by: Michal Hocko &lt;mhocko@suse.com&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: Shakeel Butt &lt;shakeelb@google.com&gt;
Cc: Dennis Zhou &lt;dennis@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm/percpu.c: remove the lcm code since block size is fixed at page size</title>
<updated>2022-11-08T06:59:18+00:00</updated>
<author>
<name>Baoquan He</name>
<email>bhe@redhat.com</email>
</author>
<published>2022-10-24T08:14:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3289e0533e70aafa9fb6d128fd4452db1b8befe8'/>
<id>3289e0533e70aafa9fb6d128fd4452db1b8befe8</id>
<content type='text'>
Since commit b239f7daf553 ("percpu: set PCPU_BITMAP_BLOCK_SIZE to
PAGE_SIZE"), the PCPU_BITMAP_BLOCK_SIZE has been set to page size
fixedly. So the lcm code in pcpu_alloc_first_chunk() doesn't make
sense any more, clean it up.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since commit b239f7daf553 ("percpu: set PCPU_BITMAP_BLOCK_SIZE to
PAGE_SIZE"), the PCPU_BITMAP_BLOCK_SIZE has been set to page size
fixedly. So the lcm code in pcpu_alloc_first_chunk() doesn't make
sense any more, clean it up.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm/percpu: replace the goto with break</title>
<updated>2022-11-08T06:59:15+00:00</updated>
<author>
<name>Baoquan He</name>
<email>bhe@redhat.com</email>
</author>
<published>2022-10-24T08:14:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=83d261fc9e5fb03e8c32e365ca4ee53952611a2b'/>
<id>83d261fc9e5fb03e8c32e365ca4ee53952611a2b</id>
<content type='text'>
In function pcpu_reclaim_populated(), the line of goto jumping is
unnecessary since the label 'end_chunk' is near the end of the for
loop, use break instead.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In function pcpu_reclaim_populated(), the line of goto jumping is
unnecessary since the label 'end_chunk' is near the end of the for
loop, use break instead.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm/percpu: add comment to state the empty populated pages accounting</title>
<updated>2022-11-08T06:59:12+00:00</updated>
<author>
<name>Baoquan He</name>
<email>bhe@redhat.com</email>
</author>
<published>2022-10-25T03:45:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=73046f8d31701c379f6db899cb09ba70a3285143'/>
<id>73046f8d31701c379f6db899cb09ba70a3285143</id>
<content type='text'>
When allocating an area from a chunk, pcpu_block_update_hint_alloc()
is called to update chunk metadata, including chunk's and global
nr_empty_pop_pages. However, if the allocation is not atomic, some
blocks may not be populated with pages yet, while we still subtract
the number here. The number of pages will be added back with
pcpu_chunk_populated() when populating pages.

Adding code comment to make that more understandable.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When allocating an area from a chunk, pcpu_block_update_hint_alloc()
is called to update chunk metadata, including chunk's and global
nr_empty_pop_pages. However, if the allocation is not atomic, some
blocks may not be populated with pages yet, while we still subtract
the number here. The number of pages will be added back with
pcpu_chunk_populated() when populating pages.

Adding code comment to make that more understandable.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm/percpu: Update the code comment when creating new chunk</title>
<updated>2022-11-08T06:59:06+00:00</updated>
<author>
<name>Baoquan He</name>
<email>bhe@redhat.com</email>
</author>
<published>2022-10-24T08:14:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e04cb6976340d5ebf2b28ad91bf6a13a285aa566'/>
<id>e04cb6976340d5ebf2b28ad91bf6a13a285aa566</id>
<content type='text'>
The lock pcpu_alloc_mutex taking code has been moved to the beginning of
pcpu_allo() if it's non atomic allocation. So the code comment above
above pcpu_create_chunk() callsite need be updated.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The lock pcpu_alloc_mutex taking code has been moved to the beginning of
pcpu_allo() if it's non atomic allocation. So the code comment above
above pcpu_create_chunk() callsite need be updated.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()</title>
<updated>2022-11-08T06:57:53+00:00</updated>
<author>
<name>Baoquan He</name>
<email>bhe@redhat.com</email>
</author>
<published>2022-10-25T03:11:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c1f6688d35d47ca11200789b000b3b20f5ecdbd9'/>
<id>c1f6688d35d47ca11200789b000b3b20f5ecdbd9</id>
<content type='text'>
To replace list_empty()/list_first_entry() pair to simplify code.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Acked-by: Dennis Zhou &lt;dennis@kernel.org&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To replace list_empty()/list_first_entry() pair to simplify code.

Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Acked-by: Dennis Zhou &lt;dennis@kernel.org&gt;
Signed-off-by: Dennis Zhou &lt;dennis@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
