From: Dan Carpenter <dan.carpenter@linaro.org>
To: yuzhao@google.com
Cc: linux-mm@kvack.org
Subject: [bug report] mm/mglru: fix underprotected page cache
Date: Fri, 12 Jan 2024 10:13:30 +0300 [thread overview]
Message-ID: <1eeadcc6-8c6a-4ba6-ab2f-1ec3b5d4730e@moroto.mountain> (raw)
Hello Yu Zhao,
The patch 081488051d28: "mm/mglru: fix underprotected page cache"
from Dec 7, 2023 (linux-next), leads to the following Smatch static
checker warning:
mm/workingset.c:318 lru_gen_refault()
warn: always true condition '(refs >= ((((1))) << (__builtin_choose_expr((4 == 4), (((2) < (64 - 26 - 3 - 3 - 0 - 10 - 0 - (8 + 14))) ?(2):(64 - 26 - 3 - 3 - 0 - 10 - 0 - (8 + 14))), ))) - 1) => (s32min-s32max >= 0)'
mm/workingset.c
308 atomic_long_add(delta, &lrugen->refaulted[hist][type][tier]);
309 mod_lruvec_state(lruvec, WORKINGSET_ACTIVATE_BASE + type, delta);
310
311 /*
312 * Count the following two cases as stalls:
313 * 1. For pages accessed through page tables, hotter pages pushed out
314 * hot pages which refaulted immediately.
315 * 2. For pages accessed multiple times through file descriptors,
316 * they would have been protected by sort_folio().
317 */
--> 318 if (lru_gen_in_fault() || refs >= BIT(LRU_REFS_WIDTH) - 1) {
^^^^^^^^^^^^^^^^^^^^^^^
In my x86 allmodconfig this is zero and refs is always >= 0. This could
be intentional, but I thought it was worth checking.
319 set_mask_bits(&folio->flags, 0, LRU_REFS_MASK | BIT(PG_workingset));
320 mod_lruvec_state(lruvec, WORKINGSET_RESTORE_BASE + type, delta);
321 }
322 unlock:
323 rcu_read_unlock();
324 }
regards,
dan carpenter
next reply other threads:[~2024-01-12 7:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 7:13 Dan Carpenter [this message]
2024-01-12 7:42 ` Yu Zhao
2024-01-12 8:29 ` Dan Carpenter
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=1eeadcc6-8c6a-4ba6-ab2f-1ec3b5d4730e@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=linux-mm@kvack.org \
--cc=yuzhao@google.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