Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755157Ab2F2PEf (ORCPT ); Fri, 29 Jun 2012 11:04:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26896 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751500Ab2F2PEe (ORCPT ); Fri, 29 Jun 2012 11:04:34 -0400 Message-ID: <4FEDC391.5030502@redhat.com> Date: Fri, 29 Jun 2012 11:02:41 -0400 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Andrea Arcangeli CC: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Hillf Danton , Dan Smith , Peter Zijlstra , Linus Torvalds , Andrew Morton , Thomas Gleixner , Ingo Molnar , Paul Turner , Suresh Siddha , Mike Galbraith , "Paul E. McKenney" , Lai Jiangshan , Bharata B Rao , Lee Schermerhorn , Johannes Weiner , Srivatsa Vaddagiri , Christoph Lameter , Alex Shi , Mauricio Faria de Oliveira , Konrad Rzeszutek Wilk , Don Morris , Benjamin Herrenschmidt Subject: Re: [PATCH 06/40] autonuma: x86 pte_numa() and pmd_numa() References: <1340888180-15355-1-git-send-email-aarcange@redhat.com> <1340888180-15355-7-git-send-email-aarcange@redhat.com> In-Reply-To: <1340888180-15355-7-git-send-email-aarcange@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2628 Lines: 92 On 06/28/2012 08:55 AM, Andrea Arcangeli wrote: > static inline int pte_file(pte_t pte) > { > - return pte_flags(pte)& _PAGE_FILE; > + return (pte_flags(pte)& _PAGE_FILE) == _PAGE_FILE; > } Wait, why is this change made? Surely _PAGE_FILE is just one single bit and this change is not useful? If there is a reason for this change, please document it. > @@ -405,7 +405,9 @@ static inline int pte_same(pte_t a, pte_t b) > > static inline int pte_present(pte_t a) > { > - return pte_flags(a)& (_PAGE_PRESENT | _PAGE_PROTNONE); > + /* _PAGE_NUMA includes _PAGE_PROTNONE */ > + return pte_flags(a)& (_PAGE_PRESENT | _PAGE_PROTNONE | > + _PAGE_NUMA_PTE); > } > > static inline int pte_hidden(pte_t pte) > @@ -415,7 +417,46 @@ static inline int pte_hidden(pte_t pte) > > static inline int pmd_present(pmd_t pmd) > { > - return pmd_flags(pmd)& _PAGE_PRESENT; > + return pmd_flags(pmd)& (_PAGE_PRESENT | _PAGE_PROTNONE | > + _PAGE_NUMA_PMD); > +} Somewhat subtle. Better documentation in patch 5 will help explain this. > +#ifdef CONFIG_AUTONUMA > +static inline int pte_numa(pte_t pte) > +{ > + return (pte_flags(pte)& > + (_PAGE_NUMA_PTE|_PAGE_PRESENT)) == _PAGE_NUMA_PTE; > +} > + > +static inline int pmd_numa(pmd_t pmd) > +{ > + return (pmd_flags(pmd)& > + (_PAGE_NUMA_PMD|_PAGE_PRESENT)) == _PAGE_NUMA_PMD; > +} > +#endif These could use a little explanation of how _PAGE_NUMA_* is used and what the flags mean. > +static inline pte_t pte_mknotnuma(pte_t pte) > +{ > + pte = pte_clear_flags(pte, _PAGE_NUMA_PTE); > + return pte_set_flags(pte, _PAGE_PRESENT|_PAGE_ACCESSED); > +} > + > +static inline pmd_t pmd_mknotnuma(pmd_t pmd) > +{ > + pmd = pmd_clear_flags(pmd, _PAGE_NUMA_PMD); > + return pmd_set_flags(pmd, _PAGE_PRESENT|_PAGE_ACCESSED); > +} > + > +static inline pte_t pte_mknuma(pte_t pte) > +{ > + pte = pte_set_flags(pte, _PAGE_NUMA_PTE); > + return pte_clear_flags(pte, _PAGE_PRESENT); > +} > + > +static inline pmd_t pmd_mknuma(pmd_t pmd) > +{ > + pmd = pmd_set_flags(pmd, _PAGE_NUMA_PMD); > + return pmd_clear_flags(pmd, _PAGE_PRESENT); > } These functions could use some explanation, too. Why do the top ones set _PAGE_ACCESSED, while the bottom ones leave _PAGE_ACCESSED alone? I can guess the answer, but it should be documented so it is also clear to people with less experience in the VM. -- All rights reversed -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/