Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752808AbbGMSwt (ORCPT ); Mon, 13 Jul 2015 14:52:49 -0400 Received: from mout.gmx.net ([212.227.17.22]:63911 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752042AbbGMSwr (ORCPT ); Mon, 13 Jul 2015 14:52:47 -0400 Message-ID: <55A408F5.601@gmx.de> Date: Mon, 13 Jul 2015 20:52:37 +0200 From: Helge Deller User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Christophe JAILLET , jejb@parisc-linux.org, mpatocka@redhat.com, kirill.shutemov@linux.intel.com CC: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, John David Anglin , Meelis Roos Subject: Re: [PATCH] parisc: mm: Fix a memory leak related to pmd not attached to the pgd References: <1436779963-4286-1-git-send-email-christophe.jaillet@wanadoo.fr> In-Reply-To: <1436779963-4286-1-git-send-email-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:iA1Yd26MMXRG0qbQZ1bb/eWydBaGQwJq9r/k5BD19SYIdMW3q4/ YAjDQJoabGSRW/An3T7K+XTFvedWdcgPK+/CBEnDvD3lbNdr511sP3HXiyw2tnpxy/itJqu 8RGcrf826bPdFmKVioMHM+x8EcRYIyKymdwmRtwOYWiiCsNdehvs/4okULGH0U/HtGye8Z9 Ibr1V394M618CntE4cqrA== X-UI-Out-Filterresults: notjunk:1;V01:K0:RSQLRLeBOM0=:350JgcbqTz2o4c4T/JDyba tHTpRCts+u9FxB/E75O7MAMHokgo+MqkdZPFitm7rg7JnqVMouLHa78XQREzg9hkQLzvUu+42 b87g2cXfVr7c/lzV3n4WCZCQAQpd7k3zdQb2wp1CL/p/iqC+7zNekhJ51E8dya2ZcAJ6AQ4WQ d+f3U3/fCXq7jhaJMn0yjuz2TsE6bWX55mJ1q7/ks39Mon0kGlna1im16q5Y/X28joyR07vTT OzMtiuCxZLwqOErReBOOUZfBz6pSZ8SupoUO9yWcbYRFpl1O+5mipa8/mrnjAZ0DHpR/I722l nzQjXS2UKrHYzxbm0xeuTKet9bafKcrnHv1jtR06LO02d5+4bm3sr+0Vwlt/CeifZO5PKapCr x64GN7skCRgrKAGr1A7TvsQBnLOlRugPh5KzUk0kBAFC9Ik+zQj6pTohZs55e0XwEbF8gopBx iFF5tKdO5vaspu1YgsnOFt9/qDFVCgoUCIkPCx/u2399dLo53CbkVxKEzW+CkBLb8rG/Hvdw3 fpPFGRKmAULC+9JocTxIYWF0P4nkHKxq9L49Q+uYdGjaNA0+QnUE/fhod/RMwAheNs+I0Reo+ ureYt1Cqhkp0WZgPcDFdpxX4LLb/K4Wf2tgam8L/RCBIiXyt2S3QJeLxc/J+WT1+O5j9KQYSV 2MshWVNAe/ss2meSd0WidZBWTeQO9A0vDRbKD5dwTFDoyEbeJtpQHf6YatpeSFeaJLeM= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2158 Lines: 66 Hi Christophe, On 13.07.2015 11:32, Christophe JAILLET wrote: > Commit 0e0da48dee8d ("parisc: mm: don't count preallocated pmds") > introduced a memory leak. > > After this commit, the 'return' statement in pmd_free is executed in all > cases. Even for pmd that are not attached to the pgd. > So 'free_pages' can never be called anymore, leading to a memory leak. That's really great!!! Thanks for spotting this! I assume this fixes the leak which killed our debian buildds with OOM after an uptime of 1-4 days and which only happened since kernel 4.0. Meelis Roos reported the issue already in this thread: http://marc.info/?l=linux-parisc&m=142999113232154&w=2 > Signed-off-by: Christophe JAILLET Acked-by: Helge Deller Will this patch be pushed via linux-mm or another tree, if not I can take it via the parisc tree? Helge > --- > This patch is *untested* as I don't have the hardware to test it. > > This is just a guess based on the indentation, the comment in the code > and the commit log. > --- > arch/parisc/include/asm/pgalloc.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h > index 3a08eae..f66d3738 100644 > --- a/arch/parisc/include/asm/pgalloc.h > +++ b/arch/parisc/include/asm/pgalloc.h > @@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) > > static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) > { > - if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) > + if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) { > /* > * This is the permanent pmd attached to the pgd; > * cannot free it. > @@ -81,6 +81,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) > */ > mm_inc_nr_pmds(mm); > return; > + } > free_pages((unsigned long)pmd, PMD_ORDER); > } > > -- 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/