From: Markus Elfring <Markus.Elfring@web.de>
To: linux-mm@kvack.org, "Andrew Morton" <akpm@linux-foundation.org>,
"Anshuman Khandual" <anshuman.khandual@arm.com>,
"Dave Jiang" <dave.jiang@intel.com>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Kirill Tkhai" <ktkhai@virtuozzo.com>,
"Ralph Campbell" <rcampbell@nvidia.com>,
"Souptick Joarder" <jrdr.linux@gmail.com>,
"Yang Shi" <yang.shi@linux.alibaba.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] mm/ksm: One function call less in __ksm_enter()
Date: Fri, 5 Jul 2019 16:16:30 +0200 [thread overview]
Message-ID: <997c8ec3-9af8-3db0-24dc-cd99fe3efe14@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jul 2019 16:02:26 +0200
Avoid an extra function call by using a ternary operator instead of
a conditional statement.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
mm/ksm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/ksm.c b/mm/ksm.c
index 3dc4346411e4..7934bab8ceae 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2521,10 +2521,10 @@ int __ksm_enter(struct mm_struct *mm)
* scanning cursor, otherwise KSM pages in newly forked mms will be
* missed: then we might as well insert at the end of the list.
*/
- if (ksm_run & KSM_RUN_UNMERGE)
- list_add_tail(&mm_slot->mm_list, &ksm_mm_head.mm_list);
- else
- list_add_tail(&mm_slot->mm_list, &ksm_scan.mm_slot->mm_list);
+ list_add_tail(&mm_slot->mm_list,
+ ksm_run & KSM_RUN_UNMERGE
+ ? &ksm_mm_head.mm_list
+ : &ksm_scan.mm_slot->mm_list);
spin_unlock(&ksm_mmlist_lock);
set_bit(MMF_VM_MERGEABLE, &mm->flags);
--
2.22.0
next reply other threads:[~2019-07-05 14:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-05 14:16 Markus Elfring [this message]
2019-07-08 6:34 ` Kirill Tkhai
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=997c8ec3-9af8-3db0-24dc-cd99fe3efe14@web.de \
--to=markus.elfring@web.de \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=dave.jiang@intel.com \
--cc=jglisse@redhat.com \
--cc=jrdr.linux@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=ktkhai@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rcampbell@nvidia.com \
--cc=yang.shi@linux.alibaba.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
Powered by JetHome