[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YtlglhbLUfGBsvw6@casper.infradead.org>
Date: Thu, 21 Jul 2022 15:20:06 +0100
From: Matthew Wilcox <willy@...radead.org>
To: "zhaoyang.huang" <zhaoyang.huang@...soc.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Zhaoyang Huang <huangzhaoyang@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, ke.wang@...soc.com
Subject: Re: [RFC PATCH] mm: set cache_trim_mode when inactive ratio is
undesired
On Thu, Jul 21, 2022 at 03:06:48PM +0800, zhaoyang.huang wrote:
> @@ -3198,7 +3215,8 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc)
> * anonymous pages.
> */
> file = lruvec_page_state(target_lruvec, NR_INACTIVE_FILE);
> - if (file >> sc->priority && !(sc->may_deactivate & DEACTIVATE_FILE))
> + if (file >> sc->priority && (!(sc->may_deactivate & DEACTIVATE_FILE)
> + || inactive_is_high(target_lruvec, LRU_INACTIVE_FILE)))
Indentation is weird here. When splitting a line, put the operator at
the end, and then indent the rest by something *other* than a single
tab, so it doesn't look like it's part of the following statement. ie
either:
if (file >> sc->priority && (!(sc->may_deactivate & DEACTIVATE_FILE) ||
inactive_is_high(target_lruvec, LRU_INACTIVE_FILE)))
or:
if (file >> sc->priority && (!(sc->may_deactivate & DEACTIVATE_FILE) ||
inactive_is_high(target_lruvec, LRU_INACTIVE_FILE)))
Some people like to use the indentation to illustrate the precendence.
That would look like this:
if (file >> sc->priority &&
(!(sc->may_deactivate & DEACTIVATE_FILE) ||
inactive_is_high(target_lruvec, LRU_INACTIVE_FILE)))
(I have a mild preference for the third option in this instance)
> sc->cache_trim_mode = 1;
> else
> sc->cache_trim_mode = 0;
> --
> 1.9.1
>
>
Powered by blists - more mailing lists