From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753464AbcBHTFz (ORCPT ); Mon, 8 Feb 2016 14:05:55 -0500 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:49796 "EHLO e06smtp17.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751185AbcBHTFy (ORCPT ); Mon, 8 Feb 2016 14:05:54 -0500 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: gerald.schaefer@de.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Mon, 8 Feb 2016 20:05:44 +0100 From: Gerald Schaefer To: Gerald Schaefer Cc: Dave Hansen , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Naoya Horiguchi , "Kirill A. Shutemov" , Konstantin Khlebnikov , Michal Hocko , Vlastimil Babka , Jerome Marchand , Johannes Weiner , Mel Gorman , Dan Williams , Ross Zwisler , Benjamin Herrenschmidt , Paul Mackerras , Martin Schwidefsky , Heiko Carstens , Michael Holzheu Subject: Re: [PATCH RFC 1/1] numa: fix /proc//numa_maps for THP Message-ID: <20160208200544.0442b453@thinkpad> In-Reply-To: <20160205170317.4906cba3@thinkpad> References: <1454686440-31218-1-git-send-email-gerald.schaefer@de.ibm.com> <1454686440-31218-2-git-send-email-gerald.schaefer@de.ibm.com> <56B4C1E1.6060408@intel.com> <20160205170317.4906cba3@thinkpad> Organization: IBM Deutschland Research & Development GmbH / Vorsitzende des Aufsichtsrats: Martina Koederitz / Geschaeftsfuehrung: Dirk Wittkopp / Sitz der Gesellschaft: Boeblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294 X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.23; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16020819-0005-0000-0000-00000A482265 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 5 Feb 2016 17:03:17 +0100 Gerald Schaefer wrote: > On Fri, 5 Feb 2016 07:38:09 -0800 > Dave Hansen wrote: > > > On 02/05/2016 07:34 AM, Gerald Schaefer wrote: > > > +static struct page *can_gather_numa_stats_pmd(pmd_t pmd, > > > + struct vm_area_struct *vma, > > > + unsigned long addr) > > > +{ > > > > Is there a way to do this without making a copy of most of > > can_gather_numa_stats()? Seems like the kind of thing where the pmd > > version will bitrot. > > > > Yes, that also gave me a little headache, even more with the vm_normal_page() > code duplication, but I didn't see a much better way. Separate _pte/_pmd > functions that largely do the same thing seem not so uncommon to me. > > The best I could think of would be splitting the !HAVE_PTE_SPECIAL path > in vm_normal_page() into a separate function, but I see not much room for > improvement for can_gather_numa_stats(), other than maybe not having > a _pmd version at all and doing all the work inside gather_pte_stats(), > but that would probably just relocate the code duplication. Nope, can't see any sane way to prevent the (trivial) code duplication in can_gather_numa_stats_pmd(). Adding a "common" function for _pte and _pmd handling (using void *) would be very ugly and given that the duplicated code is just trivial sanity checks it also seems very disproportionate. BTW, we also (should) have no "pmd version bitrot" in the countless other places where we have separate _pte/_pmd versions. So, any ideas or feedback on the vm_normal_page(_pmd) part?