From patchwork Tue Apr 11 17:42:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 749578 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w2ZJ025z8z9sN5 for ; Wed, 12 Apr 2017 03:47:12 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AjQTM91M"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3w2ZJ00rlhzDqB7 for ; Wed, 12 Apr 2017 03:47:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AjQTM91M"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3w2ZC44lMlzDq7Z for ; Wed, 12 Apr 2017 03:42:56 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AjQTM91M"; dkim-atps=neutral Received: by mail-pf0-x241.google.com with SMTP id a188so658807pfa.2 for ; Tue, 11 Apr 2017 10:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zG0YeXJKyhBpgYydkFkrIL9gm7rQsMwsNMKiJHo2Ljc=; b=AjQTM91Mr/BHdJ5mh43FXq/ixOIo3qv8GK3gMREBsM9Zly/tvDTlThNeI+/6yGHPho iZlypAG3JutJjj+STjm3O/Xxf+G5yNZyLTMZf4i4QCuoA1ok2IBuOvHuyoBGKUye/HIY zxD7e7VQMXSWYP95QTn2PeQmDbkIBHFhEk+rnGcGrnOmW5PMOoS1f+DlxZUZMSM/0A+f D6N8q0Aekma5EgiwYRX8WIlviMfbhSYHgtjr0uZKpn1Xb1RWylbML3FTmcpfjyup9VHu 1gB7F9ROPbPIqG8b199vLXyI5GFn5YIG0hh76BW1lBAK2WTa72AJVQhYthbLVJaSgfFq pW2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zG0YeXJKyhBpgYydkFkrIL9gm7rQsMwsNMKiJHo2Ljc=; b=VERC/X+qV9cxE31Fl4z/rR5OVMSgLyo2ZJeHVPNg7paizJWZ4WFMVW2pY5yAiYUIlI Bom8pdWvxuF0BMdtiZfuObLCCm5GfVLj/gdwFHL2WrrxllNyYfKQn55f3dEM0/XbnosP UNkrW+Dd4TEmPX6YPn+bCBLNKV7E5u5rzeZsDq4zhnuWjBtDoLR9R4N1+AljsvVPeT90 /UgUcm/jdE79L71iMADfV/MjVYbaEgQ1oEPzQ2/5Nxh2zs3JcHOFHiCm/3rLuJ1DqyX6 uL8ujq+b/bhWOFBSM/86PjhTClT6RfBT0EdP6x+FojwORPuzCeHFUtOyNWL5P4qsbbJL AVlA== X-Gm-Message-State: AFeK/H3YbvxyZKkwOZOd0xGLxfhw80O1M34zpdP+nZvH/125HoiQu6fiQcne86V6cuGgGA== X-Received: by 10.84.210.228 with SMTP id a91mr76097876pli.120.1491932574926; Tue, 11 Apr 2017 10:42:54 -0700 (PDT) Received: from localhost.localdomain ([103.57.0.128]) by smtp.gmail.com with ESMTPSA id r185sm20182582pfr.72.2017.04.11.10.42.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 10:42:54 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/9] mm/huge_memory: Use zap_deposited_table() more Date: Wed, 12 Apr 2017 03:42:25 +1000 Message-Id: <20170411174233.21902-2-oohall@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170411174233.21902-1-oohall@gmail.com> References: <20170411174233.21902-1-oohall@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org, arbab@linux.vnet.ibm.com, linux-mm@kvack.org, Oliver O'Halloran , "Aneesh Kumar K.V" , "Kirill A. Shutemov" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Depending flags of the PMD being zapped there may or may not be a deposited pgtable to be freed. In two of the three cases this is open coded while the third uses the zap_deposited_table() helper. This patch converts the others to use the helper to clean things up a bit. Cc: "Aneesh Kumar K.V" Cc: "Kirill A. Shutemov" Cc: linux-mm@kvack.org Signed-off-by: Oliver O'Halloran Reviewed-by: Aneesh Kumar K.V Acked-by: David Rientjes --- For reference: void zap_deposited_table(struct mm_struct *mm, pmd_t *pmd) { pgtable_t pgtable; pgtable = pgtable_trans_huge_withdraw(mm, pmd); pte_free(mm, pgtable); atomic_long_dec(&mm->nr_ptes); } --- mm/huge_memory.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index b787c4cfda0e..aa01dd47cc65 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1615,8 +1615,7 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, if (is_huge_zero_pmd(orig_pmd)) tlb_remove_page_size(tlb, pmd_page(orig_pmd), HPAGE_PMD_SIZE); } else if (is_huge_zero_pmd(orig_pmd)) { - pte_free(tlb->mm, pgtable_trans_huge_withdraw(tlb->mm, pmd)); - atomic_long_dec(&tlb->mm->nr_ptes); + zap_deposited_table(tlb->mm, pmd); spin_unlock(ptl); tlb_remove_page_size(tlb, pmd_page(orig_pmd), HPAGE_PMD_SIZE); } else { @@ -1625,10 +1624,7 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, VM_BUG_ON_PAGE(page_mapcount(page) < 0, page); VM_BUG_ON_PAGE(!PageHead(page), page); if (PageAnon(page)) { - pgtable_t pgtable; - pgtable = pgtable_trans_huge_withdraw(tlb->mm, pmd); - pte_free(tlb->mm, pgtable); - atomic_long_dec(&tlb->mm->nr_ptes); + zap_deposited_table(tlb->mm, pmd); add_mm_counter(tlb->mm, MM_ANONPAGES, -HPAGE_PMD_NR); } else { if (arch_needs_pgtable_deposit())