linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	KVM list <kvm@vger.kernel.org>, Linux MM <linux-mm@kvack.org>,
	nefelim4ag@gmail.com, Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Ingo Molnar <mingo@kernel.org>,
	zhongjiang@huawei.com,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Arvind Yadav <arvind.yadav.cs@gmail.com>,
	solee@os.korea.ac.kr, Andi Kleen <ak@linux.intel.com>
Subject: Re: [RFC v1 1/2] VS1544 KSM generic memory comparison functions
Date: Mon, 25 Sep 2017 12:06:28 +0200	[thread overview]
Message-ID: <CAMuHMdUcd01J1fXeqVQdVeOGF_YqGp9uZh4MEucVdhc+XNOAsQ@mail.gmail.com> (raw)
In-Reply-To: <1506329174-19265-2-git-send-email-imbrenda@linux.vnet.ibm.com>

Hi Claudio,

On Mon, Sep 25, 2017 at 10:46 AM, Claudio Imbrenda
<imbrenda@linux.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@linux-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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-09-25 10:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25  8:46 [RFC v1 0/2] Per-arch page checksumming and comparison Claudio Imbrenda
2017-09-25  8:46 ` [RFC v1 1/2] VS1544 KSM generic memory comparison functions Claudio Imbrenda
2017-09-25 10:06   ` Geert Uytterhoeven [this message]
2017-09-25  8:46 ` [RFC v1 2/2] VS1544 KSM s390-specific " Claudio Imbrenda
2017-09-25 11:41 ` [RFC v1 0/2] Per-arch page checksumming and comparison Andrea Arcangeli

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=CAMuHMdUcd01J1fXeqVQdVeOGF_YqGp9uZh4MEucVdhc+XNOAsQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=borntraeger@de.ibm.com \
    --cc=imbrenda@linux.vnet.ibm.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=nefelim4ag@gmail.com \
    --cc=solee@os.korea.ac.kr \
    --cc=zhongjiang@huawei.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