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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 25 Sep 2017 12:06:28 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Claudio Imbrenda <imbrenda@...ux.vnet.ibm.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        KVM list <kvm@...r.kernel.org>, Linux MM <linux-mm@...ck.org>,
        nefelim4ag@...il.com, Andrew Morton <akpm@...ux-foundation.org>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Ingo Molnar <mingo@...nel.org>, zhongjiang@...wei.com,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Arvind Yadav <arvind.yadav.cs@...il.com>, solee@...korea.ac.kr,
        Andi Kleen <ak@...ux.intel.com>
Subject: Re: [RFC v1 1/2] VS1544 KSM generic memory comparison functions

Hi Claudio,

On Mon, Sep 25, 2017 at 10:46 AM, Claudio Imbrenda
<imbrenda@...ux.vnet.ibm.com> wrote:
> This is just a refactoring of the existing code:
>
> * Split the page checksum and page comparison functions from ksm.c into
>   a new asm-generic header (page_memops.h)

... and make them inline?

> --- /dev/null
> +++ b/include/asm-generic/page_memops.h
> @@ -0,0 +1,31 @@
> +#ifndef _ASM_GENERIC_PAGE_MEMOPS_H
> +#define _ASM_GENERIC_PAGE_MEMOPS_H
> +
> +#include <linux/mm_types.h>
> +#include <linux/highmem.h>
> +#include <linux/jhash.h>
> +
> +static inline u32 calc_page_checksum(struct page *page)
> +{
> +       void *addr = kmap_atomic(page);
> +       u32 checksum;
> +
> +       checksum = jhash2(addr, PAGE_SIZE / 4, 17);
> +       kunmap_atomic(addr);
> +       return checksum;
> +}
> +
> +static inline int memcmp_pages(struct page *page1, struct page *page2)
> +{
> +       char *addr1, *addr2;
> +       int ret;
> +
> +       addr1 = kmap_atomic(page1);
> +       addr2 = kmap_atomic(page2);
> +       ret = memcmp(addr1, addr2, PAGE_SIZE);
> +       kunmap_atomic(addr2);
> +       kunmap_atomic(addr1);
> +       return ret;
> +}

Do they really have to be inline?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ