From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbcITFWW (ORCPT ); Tue, 20 Sep 2016 01:22:22 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:4535 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751105AbcITFWV (ORCPT ); Tue, 20 Sep 2016 01:22:21 -0400 Subject: Re: [PATCH v2 2/3] powerpc: get hugetlbpage handling more generic To: "Aneesh Kumar K.V" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood References: <87mvj4xwt6.fsf@linux.vnet.ibm.com> <68949cf6-c70b-f616-4586-fa438a7c17cd@c-s.fr> <877fa7xq1v.fsf@linux.vnet.ibm.com> Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org From: Christophe Leroy Message-ID: <0f2ea710-1e14-8b80-7480-cea9ffbe9dfa@c-s.fr> Date: Tue, 20 Sep 2016 07:22:17 +0200 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <877fa7xq1v.fsf@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 20/09/2016 à 04:28, Aneesh Kumar K.V a écrit : > christophe leroy writes: > >> Le 19/09/2016 à 07:50, Aneesh Kumar K.V a écrit : >>> >>> Christophe Leroy writes: >>>> +#else >>>> +static void hugepd_free(struct mmu_gather *tlb, void *hugepte) >>>> +{ >>>> + BUG(); >>>> +} >>>> + >>>> #endif >>> >>> >>> I was expecting that BUG will get removed in the next patch. But I don't >>> see it in the next patch. Considering >>> >>> @@ -475,11 +453,10 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif >>> for (i = 0; i < num_hugepd; i++, hpdp++) >>> hpdp->pd = 0; >>> >>> -#ifdef CONFIG_PPC_FSL_BOOK3E >>> - hugepd_free(tlb, hugepte); >>> -#else >>> - pgtable_free_tlb(tlb, hugepte, pdshift - shift); >>> -#endif >>> + if (shift >= pdshift) >>> + hugepd_free(tlb, hugepte); >>> + else >>> + pgtable_free_tlb(tlb, hugepte, pdshift - shift); >>> } >>> >>> What is that I am missing ? >>> >> >> Previously, call to hugepd_free() was compiled only when #ifdef >> CONFIG_PPC_FSL_BOOK3E >> Now, it is compiled at all time, but it should never be called if not >> CONFIG_PPC_FSL_BOOK3E because we always have shift < pdshift in that case. >> Then the function needs to be defined anyway but should never be called. >> Should I just define it static inline {} ? >> > > For 8M with 4K mode, we have shift >= pdshift right ? > Yes, thats the reason why in the following patch we get. That way we get a real hugepd_free() also for the 8xx. @@ -366,7 +373,7 @@ int alloc_bootmem_huge_page(struct hstate *hstate) } #endif -#ifdef CONFIG_PPC_FSL_BOOK3E +#if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx) #define HUGEPD_FREELIST_SIZE \ ((PAGE_SIZE - sizeof(struct hugepd_freelist)) / sizeof(pte_t)) Christophe