Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp236918pxh; Wed, 10 Nov 2021 00:45:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1jLEfIR3nWI8RLu/PPq5BOX7aI86gD+iSNaZ7HKiYsU1gXSfj41ESjFkIgtS1KFAZxcKZ X-Received: by 2002:a17:906:229b:: with SMTP id p27mr18260362eja.264.1636533941335; Wed, 10 Nov 2021 00:45:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636533941; cv=none; d=google.com; s=arc-20160816; b=c5GYtGjOUSsJjL/LIeSrQG5nbNja+hPjs69D4sFBiSkkyRgF2YVA5Ne9C+XJn12rLk 6PN1GlIY+Np1XIOe4iE+jX+7vqhvbdLDEUjsoDjgoC+7OR7MEdmdplAarPb8wsbu57by kdktd1riUQVL+yBKksr+3Iw3D+gIsxhJ9XdFHwSsxkAY0JFVwZQD7Un1KhCwNrabDGey h6KnfdR/mCVVRSnxA3+7iPUWWWara8SUzBZRpeibMcxGyZcG3+izE1rkkxisdrJW9DaH BxSmx9K+4lPdbQURkIDdw7BTvPlAf6MrNWkDQaEIT9eUAkPMSTDfprHogZzA92W3yeyv D8Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7ATw7hUTYZVQ0DwLa45RdRSrYNXHKuwCC3S5w4hY8zw=; b=wUpHQ60sJ375AXdTL4aNIxH8dr6vn85FprkBkmg8YALfN6dzD9BNTc/pK94cmTeluF haUOZrQnsPQachmH9oiNTHuUjyMK1vUTVgjzlsnJMKYXEvNVmT/T16kHEH5CHLtPg/Zy X8PtCs67yRt7BRLU4PN5O7pPn7Db2+CClTOJPF7sslnVhSDYVWM2dJ2j5vmMbqjm20Bn GmfLp6q9pkID+QI1Wan9LeYD9qiJ3N+fInt162wl5V6Xbw6JeRzkVRJIdUqxYQzY6TVY MeFOiTejcDkEA9g4q9NeRDdz/8xDRmGeElEcFhThHm2wSOTU4K3WOLnJ1iuBMQUOwury YelA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=cmfLwBU+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si36272826edb.233.2021.11.10.00.45.17; Wed, 10 Nov 2021 00:45:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=cmfLwBU+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbhKJIpG (ORCPT + 99 others); Wed, 10 Nov 2021 03:45:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbhKJIpD (ORCPT ); Wed, 10 Nov 2021 03:45:03 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31B26C0613F5 for ; Wed, 10 Nov 2021 00:42:16 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id u17so2382765plg.9 for ; Wed, 10 Nov 2021 00:42:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7ATw7hUTYZVQ0DwLa45RdRSrYNXHKuwCC3S5w4hY8zw=; b=cmfLwBU+Bm1CpzzA7YTIcjiVMZz4yqSlGwDAaFsgZGEl8L+xs0oT0q9kk5aEnq3nQw LOKt0Q4WxyBf7NuRLEdrDbMmyLLWjO5liJ8HjxmxNZzQwIs+Ij8/0ZAMiK40I2sKlFnY /5drhIPFmigd72gQT+hDVW9zUYeUpkWQU+sZ5y+K+yfDY46srQAHN3xRiPUQ+Cl6ZchI NIjc/Z5FOHtNxC1evaMqQoL8oH3GairafCktj7psqIoxN5lISzTj3TtM/YmXgSJhIlzL H4FeMwgGqf3zJJQk4i9KRerKfmx8NYf+NAzyw+kUN0eM1/op1FLq0hYk/Y9Hs2gQOYEU Lbdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7ATw7hUTYZVQ0DwLa45RdRSrYNXHKuwCC3S5w4hY8zw=; b=DMjvWIl0Pxs6XR/OiWxxyfaE9Phfy3eekDUqBthx40Xz3hxfmWqf4c0MokJJaztLSy fJvI3n1uhLGe87SyoMkxsrgVMxy6W/boL3Va0qpiCX1YN/NaOx8d2Lu+1DkGnXLhzCFW +n/yppCvsjcyTFqN0S6TrQUO4SZFpdYWW+/DcSasf51JqHYONg/PHq3avMC5MhqyA2ve XoaWvv4hnFndQyUkjq8PtwAfm4+El3aSWeKaMkqg9lbtCB9ze03V9TSiTPpM2f7jAiWU d7rxmgz7fDyv5QOalbMywSMlAn0tvY0NG/JDd7EhZiYBhFwxSWIhXhQJkXCylBEeyo6+ XMgw== X-Gm-Message-State: AOAM533VYl+xD8D3gUQkVW9prVRYVKpOCdGGEorJN2lhhvKuryX4UP/y yrxOBH+QlPA4/D0oC5WB5s1x8A== X-Received: by 2002:a17:902:e9c6:b0:141:c588:99b2 with SMTP id 6-20020a170902e9c600b00141c58899b2mr14187337plk.63.1636533735736; Wed, 10 Nov 2021 00:42:15 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.251]) by smtp.gmail.com with ESMTPSA id v38sm5485368pgl.38.2021.11.10.00.42.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 00:42:15 -0800 (PST) From: Qi Zheng To: akpm@linux-foundation.org, tglx@linutronix.de, kirill.shutemov@linux.intel.com, mika.penttila@nextfour.com, david@redhat.com, jgg@nvidia.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, songmuchun@bytedance.com, zhouchengming@bytedance.com, Qi Zheng Subject: [PATCH v3 08/15] mm/pte_ref: initialize the refcount of the withdrawn PTE page table page Date: Wed, 10 Nov 2021 16:40:50 +0800 Message-Id: <20211110084057.27676-9-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20211110084057.27676-1-zhengqi.arch@bytedance.com> References: <20211110084057.27676-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we split the PMD-mapped THP to the PTE-mapped THP, we should initialize the refcount of the withdrawn PTE page table page to HPAGE_PMD_NR, which ensures that we can release the PTE page table page when it is free(the refcount is 0). Signed-off-by: Qi Zheng --- mm/pgtable-generic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index 4e640baf9794..523053e09dfa 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -186,6 +186,7 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) struct page, lru); if (pmd_huge_pte(mm, pmdp)) list_del(&pgtable->lru); + pte_ref_init(pgtable, pmdp, HPAGE_PMD_NR); return pgtable; } #endif -- 2.11.0