lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 8 Jul 2019 09:34:14 +0300
From:   Kirill Tkhai <ktkhai@...tuozzo.com>
To:     Markus Elfring <Markus.Elfring@....de>, linux-mm@...ck.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Anshuman Khandual <anshuman.khandual@....com>,
        Dave Jiang <dave.jiang@...el.com>,
        Jérôme Glisse <jglisse@...hat.com>,
        Ralph Campbell <rcampbell@...dia.com>,
        Souptick Joarder <jrdr.linux@...il.com>,
        Yang Shi <yang.shi@...ux.alibaba.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] mm/ksm: One function call less in __ksm_enter()

On 05.07.2019 17:16, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.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@...rs.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);

Despite coccinelle warnings, I'm not sure this patch does not make the readability worse...

>  	spin_unlock(&ksm_mmlist_lock);
> 
>  	set_bit(MMF_VM_MERGEABLE, &mm->flags);

Powered by blists - more mailing lists