From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org, ying.huang@intel.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Wei Yang <richard.weiyang@gmail.com>
Subject: [PATCH 3/3] mm/swapfile.c: count won't be bigger than SWAP_MAP_MAX
Date: Fri, 1 May 2020 01:52:59 +0000 [thread overview]
Message-ID: <20200501015259.32237-3-richard.weiyang@gmail.com> (raw)
In-Reply-To: <20200501015259.32237-1-richard.weiyang@gmail.com>
When the condition is true, there are two possibilities:
1. count == SWAP_MAP_BAD
2. count == (SWAP_MAP_MAX & COUNT_CONTINUED) == SWAP_MAP_SHMEM
The first case would be filtered by the first if in __swap_duplicate().
And the second case means this swap entry is for shmem. Since we never
do another duplication for shmem swap entry. This won't happen neither.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
mm/swapfile.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 1a877d1d40e3..88dd2ad34aad 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3404,8 +3404,6 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage)
if ((count & ~COUNT_CONTINUED) < SWAP_MAP_MAX)
count += usage;
- else if ((count & ~COUNT_CONTINUED) > SWAP_MAP_MAX)
- err = -EINVAL;
else if (swap_count_continued(p, offset, count))
count = COUNT_CONTINUED;
else
--
2.23.0
next prev parent reply other threads:[~2020-05-01 1:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 1:52 [PATCH 1/3] mm/swapfile.c: classify SWAP_MAP_XXX to make it more readable Wei Yang
2020-05-01 1:52 ` [PATCH 2/3] mm/swapfile.c: __swap_entry_free() always free 1 entry Wei Yang
2020-05-01 1:52 ` Wei Yang [this message]
2020-05-01 22:48 ` [PATCH 3/3] mm/swapfile.c: count won't be bigger than SWAP_MAP_MAX Andrew Morton
2020-05-02 13:29 ` Wei Yang
2020-05-02 13:41 ` Wei Yang
2020-05-06 8:22 ` Huang, Ying
2020-05-07 22:20 ` Wei Yang
2020-05-07 23:48 ` Huang, Ying
2020-05-08 21:19 ` Wei Yang
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=20200501015259.32237-3-richard.weiyang@gmail.com \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ying.huang@intel.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).