From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753224AbcLQHxb (ORCPT ); Sat, 17 Dec 2016 02:53:31 -0500 Received: from asavdk3.altibox.net ([109.247.116.14]:37197 "EHLO asavdk3.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbcLQHxa (ORCPT ); Sat, 17 Dec 2016 02:53:30 -0500 Date: Sat, 17 Dec 2016 08:53:25 +0100 From: Sam Ravnborg To: Mike Kravetz Cc: sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "David S . Miller" , Bob Picco , Nitin Gupta , Vijay Kumar , Julian Calaby , Adam Buchbinder , "Kirill A . Shutemov" , Michal Hocko , Andrew Morton Subject: Re: [RFC PATCH 06/14] sparc64: general shared context tsb creation and support Message-ID: <20161217075325.GD23567@ravnborg.org> References: <1481913337-9331-1-git-send-email-mike.kravetz@oracle.com> <1481913337-9331-7-git-send-email-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1481913337-9331-7-git-send-email-mike.kravetz@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.2 cv=WJY9ZTkR c=1 sm=1 tr=0 a=Ij76tQDYWdb01v2+RnYW5w==:117 a=Ij76tQDYWdb01v2+RnYW5w==:17 a=kj9zAlcOel0A:10 a=KPyckp9uo7MuBTM6E-EA:9 a=ChppNnjYDXa8j4zw:21 a=3udrcpKhve3wP01d:21 a=CjuIK1q_8ugA:10 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mike > --- a/arch/sparc/mm/hugetlbpage.c > +++ b/arch/sparc/mm/hugetlbpage.c > @@ -162,8 +162,14 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, > { > pte_t orig; > > - if (!pte_present(*ptep) && pte_present(entry)) > - mm->context.hugetlb_pte_count++; > + if (!pte_present(*ptep) && pte_present(entry)) { > +#if defined(CONFIG_SHARED_MMU_CTX) > + if (pte_val(entry) | _PAGE_SHR_CTX_4V) > + mm->context.shared_hugetlb_pte_count++; > + else > +#endif > + mm->context.hugetlb_pte_count++; > + } This kind of conditional code it just too ugly to survive... Could a static inline be used to help you here? The compiler will inline it so there should not be any run-time cost > > mm_rss -= saved_thp_pte_count * (HPAGE_SIZE / PAGE_SIZE); > #endif > @@ -544,8 +576,10 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) > * us, so we need to zero out the TSB pointer or else tsb_grow() > * will be confused and think there is an older TSB to free up. > */ > - for (i = 0; i < MM_NUM_TSBS; i++) > + for (i = 0; i < MM_NUM_TSBS; i++) { > mm->context.tsb_block[i].tsb = NULL; > + mm->context.tsb_descr[i].tsb_base = 0UL; > + } This change seems un-related to the rest? Sam