[rh7,2/2] mm/tcache: initialize 'repeat' variable only once

Submitted by Andrey Ryabinin on Feb. 28, 2018, 3:01 p.m.

Details

Message ID 20180228150154.17587-2-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin Feb. 28, 2018, 3:01 p.m.
It's pointless to re-initialize the 'repeat' variable before
invalidation retry since it's used only in the first ivalidate
attempt (when synchronize_sched_once == true).

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/tcache.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/tcache.c b/mm/tcache.c
index 31a9eb3d1e12..02fde409e691 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -915,7 +915,7 @@  repeat:
 static noinline_for_stack void
 tcache_invalidate_node_pages(struct tcache_node *node)
 {
-	bool repeat, synchronize_sched_once = true;
+	bool repeat = false, synchronize_sched_once = true;
 	pgoff_t indices[TCACHE_PAGEVEC_SIZE];
 	struct page *pages[TCACHE_PAGEVEC_SIZE];
 	pgoff_t index;
@@ -927,7 +927,6 @@  tcache_invalidate_node_pages(struct tcache_node *node)
 	 */
 again:
 	index = 0;
-	repeat = false;
 	while ((nr_pages = tcache_lookup(pages, node, index,
 						TCACHE_PAGEVEC_SIZE, indices))) {
 		for (i = 0; i < nr_pages; i++) {

Comments

Kirill Tkhai Feb. 28, 2018, 4:06 p.m.
On 28.02.2018 18:01, Andrey Ryabinin wrote:
> It's pointless to re-initialize the 'repeat' variable before
> invalidation retry since it's used only in the first ivalidate
> attempt (when synchronize_sched_once == true).
> 
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>

Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  mm/tcache.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/tcache.c b/mm/tcache.c
> index 31a9eb3d1e12..02fde409e691 100644
> --- a/mm/tcache.c
> +++ b/mm/tcache.c
> @@ -915,7 +915,7 @@ repeat:
>  static noinline_for_stack void
>  tcache_invalidate_node_pages(struct tcache_node *node)
>  {
> -	bool repeat, synchronize_sched_once = true;
> +	bool repeat = false, synchronize_sched_once = true;
>  	pgoff_t indices[TCACHE_PAGEVEC_SIZE];
>  	struct page *pages[TCACHE_PAGEVEC_SIZE];
>  	pgoff_t index;
> @@ -927,7 +927,6 @@ tcache_invalidate_node_pages(struct tcache_node *node)
>  	 */
>  again:
>  	index = 0;
> -	repeat = false;
>  	while ((nr_pages = tcache_lookup(pages, node, index,
>  						TCACHE_PAGEVEC_SIZE, indices))) {
>  		for (i = 0; i < nr_pages; i++) {
>