linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Zhaoyang Huang <huangzhaoyang@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	ke.wang@unisoc.com
Subject: Re: [RFC PATCH] mm: set cache_trim_mode when inactive ratio is undesired
Date: Thu, 21 Jul 2022 15:20:06 +0100	[thread overview]
Message-ID: <YtlglhbLUfGBsvw6@casper.infradead.org> (raw)
In-Reply-To: <1658387208-20065-1-git-send-email-zhaoyang.huang@unisoc.com>

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
> 
> 

      reply	other threads:[~2022-07-21 14:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21  7:06 [RFC PATCH] mm: set cache_trim_mode when inactive ratio is undesired zhaoyang.huang
2022-07-21 14:20 ` Matthew Wilcox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YtlglhbLUfGBsvw6@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=huangzhaoyang@gmail.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=ke.wang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zhaoyang.huang@unisoc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).