<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/lib/test_vmalloc.c, branch v6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-01-19T01:12:41Z</updated>
<entry>
<title>lib/test_vmalloc.c: add parameter use_huge for fix_size_alloc_test</title>
<updated>2023-01-19T01:12:41Z</updated>
<author>
<name>Qinglin Pan</name>
<email>panqinglin2020@iscas.ac.cn</email>
</author>
<published>2022-12-12T05:56:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6b1ead5985bf73b7dd4453f5cd3b8690a9c52cd5'/>
<id>urn:sha1:6b1ead5985bf73b7dd4453f5cd3b8690a9c52cd5</id>
<content type='text'>
Add a parameter `use_huge' for fix_size_alloc_test(), which can be used to
test allocation vie vmalloc_huge for both functionality and performance.

Link: https://lkml.kernel.org/r/20221212055657.698420-1-panqinglin2020@iscas.ac.cn
Signed-off-by: Qinglin Pan &lt;panqinglin2020@iscas.ac.cn&gt;
Cc: "Uladzislau Rezki (Sony)" &lt;urezki@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>treewide: use get_random_u32_inclusive() when possible</title>
<updated>2022-11-18T01:18:02Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-10-10T02:44:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e8a533cbeb79809206f8724e89961e0079508c3c'/>
<id>urn:sha1:e8a533cbeb79809206f8724e89961e0079508c3c</id>
<content type='text'>
These cases were done with this Coccinelle:

@@
expression H;
expression L;
@@
- (get_random_u32_below(H) + L)
+ get_random_u32_inclusive(L, H + L - 1)

@@
expression H;
expression L;
expression E;
@@
  get_random_u32_inclusive(L,
  H
- + E
- - E
  )

@@
expression H;
expression L;
expression E;
@@
  get_random_u32_inclusive(L,
  H
- - E
- + E
  )

@@
expression H;
expression L;
expression E;
expression F;
@@
  get_random_u32_inclusive(L,
  H
- - E
  + F
- + E
  )

@@
expression H;
expression L;
expression E;
expression F;
@@
  get_random_u32_inclusive(L,
  H
- + E
  + F
- - E
  )

And then subsequently cleaned up by hand, with several automatic cases
rejected if it didn't make sense contextually.

Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Jason Gunthorpe &lt;jgg@nvidia.com&gt; # for infiniband
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>treewide: use get_random_u32_below() instead of deprecated function</title>
<updated>2022-11-18T01:15:15Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-10-10T02:44:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8032bf1233a74627ce69b803608e650f3f35971c'/>
<id>urn:sha1:8032bf1233a74627ce69b803608e650f3f35971c</id>
<content type='text'>
This is a simple mechanical transformation done by:

@@
expression E;
@@
- prandom_u32_max
+ get_random_u32_below
  (E)

Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Darrick J. Wong &lt;djwong@kernel.org&gt; # for xfs
Reviewed-by: SeongJae Park &lt;sj@kernel.org&gt; # for damon
Reviewed-by: Jason Gunthorpe &lt;jgg@nvidia.com&gt; # for infiniband
Reviewed-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt; # for arm
Acked-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt; # for mmc
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>treewide: use get_random_{u8,u16}() when possible, part 2</title>
<updated>2022-10-11T23:42:58Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-10-05T15:23:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f743f16c548b1a2633e8b6034058d6475d7f26a3'/>
<id>urn:sha1:f743f16c548b1a2633e8b6034058d6475d7f26a3</id>
<content type='text'>
Rather than truncate a 32-bit value to a 16-bit value or an 8-bit value,
simply use the get_random_{u8,u16}() functions, which are faster than
wasting the additional bytes from a 32-bit value. This was done by hand,
identifying all of the places where one of the random integer functions
was used in a non-32-bit context.

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Yury Norov &lt;yury.norov@gmail.com&gt;
Acked-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt; # for s390
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>treewide: use prandom_u32_max() when possible, part 2</title>
<updated>2022-10-11T23:42:58Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-10-05T14:43:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8b3ccbc1f1f91847160951aa15dd27c22dddcb49'/>
<id>urn:sha1:8b3ccbc1f1f91847160951aa15dd27c22dddcb49</id>
<content type='text'>
Rather than incurring a division or requesting too many random bytes for
the given range, use the prandom_u32_max() function, which only takes
the minimum required bytes from the RNG and avoids divisions. This was
done by hand, covering things that coccinelle could not do on its own.

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Yury Norov &lt;yury.norov@gmail.com&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt; # for ext2, ext4, and sbitmap
Acked-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>lib/test_vmalloc: switch to prandom_u32()</title>
<updated>2022-07-04T01:08:42Z</updated>
<author>
<name>Uladzislau Rezki (Sony)</name>
<email>urezki@gmail.com</email>
</author>
<published>2022-06-07T09:34:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5e21f2d577cf174ced5fe9bdff67dcb70190d9f8'/>
<id>urn:sha1:5e21f2d577cf174ced5fe9bdff67dcb70190d9f8</id>
<content type='text'>
A get_random_bytes() function can cause a high contention if it is called
across CPUs simultaneously.  Because it shares one lock per all CPUs:

&lt;snip&gt;
   class name     con-bounces  contentions   waittime-min   waittime-max waittime-total   waittime-avg    acq-bounces   acquisitions   holdtime-min   holdtime-max holdtime-total   holdtime-avg
   &amp;crng-&gt;lock:   663145       665886        0.05           8.85         261966.66        0.39            7188152       13731279       0.04           11.89        2181582.30       0.16
   -----------
   &amp;crng-&gt;lock    307835       [&lt;00000000acba59cd&gt;] _extract_crng+0x48/0x90
   &amp;crng-&gt;lock    358051       [&lt;00000000f0075abc&gt;] _crng_backtrack_protect+0x32/0x90
   -----------
   &amp;crng-&gt;lock    234241       [&lt;00000000f0075abc&gt;] _crng_backtrack_protect+0x32/0x90
   &amp;crng-&gt;lock    431645       [&lt;00000000acba59cd&gt;] _extract_crng+0x48/0x90
&lt;snip&gt;

Switch from the get_random_bytes() to prandom_u32() that does not have any
internal contention when a random value is needed for the tests.

The reason is to minimize CPU cycles introduced by the test-suite itself
from the vmalloc performance metrics.

Link: https://lkml.kernel.org/r/20220607093449.3100-6-urezki@gmail.com
Signed-off-by: Uladzislau Rezki (Sony) &lt;urezki@gmail.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Cc: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Cc: Oleksiy Avramchenko &lt;oleksiy.avramchenko@sony.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lib/test_vmalloc.c: use swap() to make code cleaner</title>
<updated>2021-11-06T20:30:37Z</updated>
<author>
<name>Changcheng Deng</name>
<email>deng.changcheng@zte.com.cn</email>
</author>
<published>2021-11-05T20:39:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=34b46efd6ec6a6f2d6a57be4216b820c879a0030'/>
<id>urn:sha1:34b46efd6ec6a6f2d6a57be4216b820c879a0030</id>
<content type='text'>
Use swap() in order to make code cleaner.  Issue found by coccinelle.

Link: https://lkml.kernel.org/r/20211028111443.15744-1-deng.changcheng@zte.com.cn
Signed-off-by: Changcheng Deng &lt;deng.changcheng@zte.com.cn&gt;
Reported-by: Zeal Robot &lt;zealci@zte.com.cn&gt;
Reviewed-by: Uladzislau Rezki (Sony) &lt;urezki@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lib/test_vmalloc.c: add a new 'nr_pages' parameter</title>
<updated>2021-09-03T16:58:14Z</updated>
<author>
<name>Uladzislau Rezki (Sony)</name>
<email>urezki@gmail.com</email>
</author>
<published>2021-09-02T21:57:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f8bcbecfb6b48c026e2205679c063d1f16f5a2c0'/>
<id>urn:sha1:f8bcbecfb6b48c026e2205679c063d1f16f5a2c0</id>
<content type='text'>
In order to simulate different fixed sizes for vmalloc allocation
introduce a new parameter that sets number of pages to be allocated for
the "fix_size_alloc_test" test.

By default 1 page is used unless a different number is specified over the
new parameter.

Link: https://lkml.kernel.org/r/20210710194151.21370-1-urezki@gmail.com
Signed-off-by: Uladzislau Rezki (Sony) &lt;urezki@gmail.com&gt;
Cc: Mel Gorman &lt;mgorman@suse.de&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Cc: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: Michal Hocko &lt;mhocko@suse.com&gt;
Cc: Oleksiy Avramchenko &lt;oleksiy.avramchenko@sonymobile.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lib/test_vmalloc.c: add a new 'nr_threads' parameter</title>
<updated>2021-04-30T18:20:40Z</updated>
<author>
<name>Uladzislau Rezki (Sony)</name>
<email>urezki@gmail.com</email>
</author>
<published>2021-04-30T05:59:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=80f4759964cc70ca8e3c793afbecbdc235ce7272'/>
<id>urn:sha1:80f4759964cc70ca8e3c793afbecbdc235ce7272</id>
<content type='text'>
By using this parameter we can specify how many workers are created to
perform vmalloc tests.  By default it is one CPU.  The maximum value is
set to 1024.

As a result of this change a 'single_cpu_test' one becomes obsolete,
therefore it is no longer needed.

[urezki@gmail.com: extend max value of nr_threads parameter]
  Link: https://lkml.kernel.org/r/20210406124536.19658-1-urezki@gmail.com

Link: https://lkml.kernel.org/r/20210402202237.20334-2-urezki@gmail.com
Signed-off-by: Uladzislau Rezki (Sony) &lt;urezki@gmail.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Cc: Michal Hocko &lt;mhocko@suse.com&gt;
Cc: Oleksiy Avramchenko &lt;oleksiy.avramchenko@sonymobile.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lib/test_vmalloc.c: remove two kvfree_rcu() tests</title>
<updated>2021-04-30T18:20:40Z</updated>
<author>
<name>Uladzislau Rezki (Sony)</name>
<email>urezki@gmail.com</email>
</author>
<published>2021-04-30T05:59:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a803315858bf8c6863f719f9fb251576fdf68a8c'/>
<id>urn:sha1:a803315858bf8c6863f719f9fb251576fdf68a8c</id>
<content type='text'>
Remove two test cases related to kvfree_rcu() and SLAB.  Those are
considered as redundant now, because similar test functionality has
recently been introduced in the "rcuscale" RCU test-suite.

Link: https://lkml.kernel.org/r/20210402202237.20334-1-urezki@gmail.com
Signed-off-by: Uladzislau Rezki (Sony) &lt;urezki@gmail.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: Michal Hocko &lt;mhocko@suse.com&gt;
Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Cc: Oleksiy Avramchenko &lt;oleksiy.avramchenko@sonymobile.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
