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