[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130807132812.60ad4bfe85127794094d385e@linux-foundation.org>
Date: Wed, 7 Aug 2013 13:28:12 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Cyrill Gorcunov <gorcunov@...il.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
luto@...capital.net, gorcunov@...nvz.org, xemul@...allels.com,
mpm@...enic.com, xiaoguangrong@...ux.vnet.ibm.com,
mtosatti@...hat.com, kosaki.motohiro@...il.com,
sfr@...b.auug.org.au, peterz@...radead.org,
aneesh.kumar@...ux.vnet.ibm.com
Subject: Re: [patch 2/2] [PATCH] mm: Save soft-dirty bits on file pages
On Wed, 31 Jul 2013 00:41:56 +0400 Cyrill Gorcunov <gorcunov@...il.com> wrote:
> +#define pte_to_pgoff(pte) \
> + ((((pte).pte_low >> (PTE_FILE_SHIFT1)) \
> + & ((1U << PTE_FILE_BITS1) - 1))) \
> + + ((((pte).pte_low >> (PTE_FILE_SHIFT2)) \
> + & ((1U << PTE_FILE_BITS2) - 1)) \
> + << (PTE_FILE_BITS1)) \
> + + ((((pte).pte_low >> (PTE_FILE_SHIFT3)) \
> + & ((1U << PTE_FILE_BITS3) - 1)) \
> + << (PTE_FILE_BITS1 + PTE_FILE_BITS2)) \
> + + ((((pte).pte_low >> (PTE_FILE_SHIFT4))) \
> + << (PTE_FILE_BITS1 + PTE_FILE_BITS2 + PTE_FILE_BITS3))
> +
> +#define pgoff_to_pte(off) \
> + ((pte_t) { .pte_low = \
> + ((((off)) & ((1U << PTE_FILE_BITS1) - 1)) << PTE_FILE_SHIFT1) \
> + + ((((off) >> PTE_FILE_BITS1) \
> + & ((1U << PTE_FILE_BITS2) - 1)) \
> + << PTE_FILE_SHIFT2) \
> + + ((((off) >> (PTE_FILE_BITS1 + PTE_FILE_BITS2)) \
> + & ((1U << PTE_FILE_BITS3) - 1)) \
> + << PTE_FILE_SHIFT3) \
> + + ((((off) >> \
> + (PTE_FILE_BITS1 + PTE_FILE_BITS2 + PTE_FILE_BITS3))) \
> + << PTE_FILE_SHIFT4) \
> + + _PAGE_FILE })
Good god.
I wonder if these can be turned into out-of-line functions in some form
which humans can understand.
or
#define pte_to_pgoff(pte)
frob(pte, PTE_FILE_SHIFT1, PTE_FILE_BITS1) +
frob(PTE_FILE_SHIFT2, PTE_FILE_BITS2) +
frob(PTE_FILE_SHIFT3, PTE_FILE_BITS3) +
frob(PTE_FILE_SHIFT4, PTE_FILE_BITS1 + PTE_FILE_BITS2 + PTE_FILE_BITS3)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists