From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751193AbbCGU4W (ORCPT ); Sat, 7 Mar 2015 15:56:22 -0500 Received: from cantor2.suse.de ([195.135.220.15]:57907 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750710AbbCGU4V (ORCPT ); Sat, 7 Mar 2015 15:56:21 -0500 Date: Sat, 7 Mar 2015 20:56:16 +0000 From: Mel Gorman To: Linus Torvalds Cc: Dave Chinner , Andrew Morton , Ingo Molnar , Aneesh Kumar , Linux Kernel Mailing List , Linux-MM , xfs@oss.sgi.com, ppc-dev Subject: Re: [PATCH 1/4] mm: thp: Return the correct value for change_huge_pmd Message-ID: <20150307205616.GZ3087@suse.de> References: <1425741651-29152-1-git-send-email-mgorman@suse.de> <1425741651-29152-2-git-send-email-mgorman@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 07, 2015 at 12:31:03PM -0800, Linus Torvalds wrote: > On Sat, Mar 7, 2015 at 7:20 AM, Mel Gorman wrote: > > > > if (!prot_numa || !pmd_protnone(*pmd)) { > > - ret = 1; > > entry = pmdp_get_and_clear_notify(mm, addr, pmd); > > entry = pmd_modify(entry, newprot); > > ret = HPAGE_PMD_NR; > > Hmm. I know I acked this already, but the return value - which correct > - is still potentially something we could improve upon. > > In particular, we don't need to flush the TLB's if the old entry was > not present. Sadly, we don't have a helper function for that. > > But the code *could* do something like > > entry = pmdp_get_and_clear_notify(mm, addr, pmd); > ret = pmd_tlb_cacheable(entry) ? HPAGE_PMD_NR : 1; > entry = pmd_modify(entry, newprot); > > where pmd_tlb_cacheable() on x86 would test if _PAGE_PRESENT (bit #0) is set. > I agree with you in principle. pmd_tlb_cacheable looks and sounds very similar to pte_accessible(). > In particular, that would mean that as we change *from* a protnone > (whether NUMA or really protnone) we wouldn't need to flush the TLB. > > In fact, we could make it even more aggressive: it's not just an old > non-present TLB entry that doesn't need flushing - we can avoid the > flushing whenever we strictly increase the access rigths. So we could > have something that takes the old entry _and_ the new protections into > account, and avoids the TLB flush if the new entry is strictly more > permissive. > > This doesn't explain the extra TLB flushes Dave sees, though, because > the old code didn't make those kinds of optimizations either. But > maybe something like this is worth doing. > I think it is worth doing although it'll be after LSF/MM before I do it. I severely doubt this is what Dave is seeing because the vmstats indicated there was no THP activity but it's still a good idea. -- Mel Gorman SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.sgi.com (relay3.corp.sgi.com [198.149.34.15]) by oss.sgi.com (Postfix) with ESMTP id 6A1057F5A for ; Sat, 7 Mar 2015 14:56:25 -0600 (CST) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay3.corp.sgi.com (Postfix) with ESMTP id D94FBAC001 for ; Sat, 7 Mar 2015 12:56:24 -0800 (PST) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by cuda.sgi.com with ESMTP id HiKuBQ4SvYsZt9w1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO) for ; Sat, 07 Mar 2015 12:56:22 -0800 (PST) Date: Sat, 7 Mar 2015 20:56:16 +0000 From: Mel Gorman Subject: Re: [PATCH 1/4] mm: thp: Return the correct value for change_huge_pmd Message-ID: <20150307205616.GZ3087@suse.de> References: <1425741651-29152-1-git-send-email-mgorman@suse.de> <1425741651-29152-2-git-send-email-mgorman@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: Linus Torvalds Cc: Linux Kernel Mailing List , xfs@oss.sgi.com, Linux-MM , Aneesh Kumar , Andrew Morton , ppc-dev , Ingo Molnar On Sat, Mar 07, 2015 at 12:31:03PM -0800, Linus Torvalds wrote: > On Sat, Mar 7, 2015 at 7:20 AM, Mel Gorman wrote: > > > > if (!prot_numa || !pmd_protnone(*pmd)) { > > - ret = 1; > > entry = pmdp_get_and_clear_notify(mm, addr, pmd); > > entry = pmd_modify(entry, newprot); > > ret = HPAGE_PMD_NR; > > Hmm. I know I acked this already, but the return value - which correct > - is still potentially something we could improve upon. > > In particular, we don't need to flush the TLB's if the old entry was > not present. Sadly, we don't have a helper function for that. > > But the code *could* do something like > > entry = pmdp_get_and_clear_notify(mm, addr, pmd); > ret = pmd_tlb_cacheable(entry) ? HPAGE_PMD_NR : 1; > entry = pmd_modify(entry, newprot); > > where pmd_tlb_cacheable() on x86 would test if _PAGE_PRESENT (bit #0) is set. > I agree with you in principle. pmd_tlb_cacheable looks and sounds very similar to pte_accessible(). > In particular, that would mean that as we change *from* a protnone > (whether NUMA or really protnone) we wouldn't need to flush the TLB. > > In fact, we could make it even more aggressive: it's not just an old > non-present TLB entry that doesn't need flushing - we can avoid the > flushing whenever we strictly increase the access rigths. So we could > have something that takes the old entry _and_ the new protections into > account, and avoids the TLB flush if the new entry is strictly more > permissive. > > This doesn't explain the extra TLB flushes Dave sees, though, because > the old code didn't make those kinds of optimizations either. But > maybe something like this is worth doing. > I think it is worth doing although it'll be after LSF/MM before I do it. I severely doubt this is what Dave is seeing because the vmstats indicated there was no THP activity but it's still a good idea. -- Mel Gorman SUSE Labs _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) by kanga.kvack.org (Postfix) with ESMTP id 926F76B0038 for ; Sat, 7 Mar 2015 15:56:22 -0500 (EST) Received: by wevm14 with SMTP id m14so66191022wev.13 for ; Sat, 07 Mar 2015 12:56:22 -0800 (PST) Received: from mx2.suse.de (cantor2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id z5si26884898wjz.64.2015.03.07.12.56.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Mar 2015 12:56:21 -0800 (PST) Date: Sat, 7 Mar 2015 20:56:16 +0000 From: Mel Gorman Subject: Re: [PATCH 1/4] mm: thp: Return the correct value for change_huge_pmd Message-ID: <20150307205616.GZ3087@suse.de> References: <1425741651-29152-1-git-send-email-mgorman@suse.de> <1425741651-29152-2-git-send-email-mgorman@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Linus Torvalds Cc: Dave Chinner , Andrew Morton , Ingo Molnar , Aneesh Kumar , Linux Kernel Mailing List , Linux-MM , xfs@oss.sgi.com, ppc-dev On Sat, Mar 07, 2015 at 12:31:03PM -0800, Linus Torvalds wrote: > On Sat, Mar 7, 2015 at 7:20 AM, Mel Gorman wrote: > > > > if (!prot_numa || !pmd_protnone(*pmd)) { > > - ret = 1; > > entry = pmdp_get_and_clear_notify(mm, addr, pmd); > > entry = pmd_modify(entry, newprot); > > ret = HPAGE_PMD_NR; > > Hmm. I know I acked this already, but the return value - which correct > - is still potentially something we could improve upon. > > In particular, we don't need to flush the TLB's if the old entry was > not present. Sadly, we don't have a helper function for that. > > But the code *could* do something like > > entry = pmdp_get_and_clear_notify(mm, addr, pmd); > ret = pmd_tlb_cacheable(entry) ? HPAGE_PMD_NR : 1; > entry = pmd_modify(entry, newprot); > > where pmd_tlb_cacheable() on x86 would test if _PAGE_PRESENT (bit #0) is set. > I agree with you in principle. pmd_tlb_cacheable looks and sounds very similar to pte_accessible(). > In particular, that would mean that as we change *from* a protnone > (whether NUMA or really protnone) we wouldn't need to flush the TLB. > > In fact, we could make it even more aggressive: it's not just an old > non-present TLB entry that doesn't need flushing - we can avoid the > flushing whenever we strictly increase the access rigths. So we could > have something that takes the old entry _and_ the new protections into > account, and avoids the TLB flush if the new entry is strictly more > permissive. > > This doesn't explain the extra TLB flushes Dave sees, though, because > the old code didn't make those kinds of optimizations either. But > maybe something like this is worth doing. > I think it is worth doing although it'll be after LSF/MM before I do it. I severely doubt this is what Dave is seeing because the vmstats indicated there was no THP activity but it's still a good idea. -- Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id A48E41A03B9 for ; Sun, 8 Mar 2015 07:56:24 +1100 (AEDT) Date: Sat, 7 Mar 2015 20:56:16 +0000 From: Mel Gorman To: Linus Torvalds Subject: Re: [PATCH 1/4] mm: thp: Return the correct value for change_huge_pmd Message-ID: <20150307205616.GZ3087@suse.de> References: <1425741651-29152-1-git-send-email-mgorman@suse.de> <1425741651-29152-2-git-send-email-mgorman@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 In-Reply-To: Cc: Dave Chinner , Linux Kernel Mailing List , xfs@oss.sgi.com, Linux-MM , Aneesh Kumar , Andrew Morton , ppc-dev , Ingo Molnar List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sat, Mar 07, 2015 at 12:31:03PM -0800, Linus Torvalds wrote: > On Sat, Mar 7, 2015 at 7:20 AM, Mel Gorman wrote: > > > > if (!prot_numa || !pmd_protnone(*pmd)) { > > - ret = 1; > > entry = pmdp_get_and_clear_notify(mm, addr, pmd); > > entry = pmd_modify(entry, newprot); > > ret = HPAGE_PMD_NR; > > Hmm. I know I acked this already, but the return value - which correct > - is still potentially something we could improve upon. > > In particular, we don't need to flush the TLB's if the old entry was > not present. Sadly, we don't have a helper function for that. > > But the code *could* do something like > > entry = pmdp_get_and_clear_notify(mm, addr, pmd); > ret = pmd_tlb_cacheable(entry) ? HPAGE_PMD_NR : 1; > entry = pmd_modify(entry, newprot); > > where pmd_tlb_cacheable() on x86 would test if _PAGE_PRESENT (bit #0) is set. > I agree with you in principle. pmd_tlb_cacheable looks and sounds very similar to pte_accessible(). > In particular, that would mean that as we change *from* a protnone > (whether NUMA or really protnone) we wouldn't need to flush the TLB. > > In fact, we could make it even more aggressive: it's not just an old > non-present TLB entry that doesn't need flushing - we can avoid the > flushing whenever we strictly increase the access rigths. So we could > have something that takes the old entry _and_ the new protections into > account, and avoids the TLB flush if the new entry is strictly more > permissive. > > This doesn't explain the extra TLB flushes Dave sees, though, because > the old code didn't make those kinds of optimizations either. But > maybe something like this is worth doing. > I think it is worth doing although it'll be after LSF/MM before I do it. I severely doubt this is what Dave is seeing because the vmstats indicated there was no THP activity but it's still a good idea. -- Mel Gorman SUSE Labs