Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2148959rdb; Sun, 4 Feb 2024 18:06:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdZ1S+1MjeRsRTzY88mR56ZrwLBg1AXhenVvDqvDoUmOYduXvOI2sJDr5srAogz7hLcGO7 X-Received: by 2002:a17:906:1d6:b0:a37:1c9d:b01d with SMTP id 22-20020a17090601d600b00a371c9db01dmr6520107ejj.2.1707098762532; Sun, 04 Feb 2024 18:06:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707098762; cv=pass; d=google.com; s=arc-20160816; b=hvG9UpuqWUyEU9JqMA7Grb8/36qi8A7FCuZBpCcXDS+jyFzGzavpdNWzV/LCNxQv+t mEf7nx47NCzPvuyKCiVNIkTGE8GKtYUVpd3GdMgdIurs06nhXy40q8pqOQCywxfIA+fe SGKSH3tBncDqV71G0Kh3yx7/zPuvMA/PpR3eVJtL9dkkCyFqkr5Z6f43LCk342CYoNkG i4W+fdnoiX+2nk4nfv+PtFsfInZSv0uvpS3HRXgXYBRfFPYo5lHpaKOjdQZYtWusYxim cihPwvz+fIjA2KUSlLQ4kOsXC9OEW2QFPRCsBxYj0ZdJMNWFZDzvt9D+d0PaphTHKqS5 ByDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=O+8ijc4eH6dLtZNsmA9IMPtPI2LG666HTBs74Wzg/oA=; fh=4/izXhxed/gzokg/KCjGz9CDO+d6a1mctQrxDGRGB2U=; b=h+VfIb3rUrbJ3yOzh+m6gwUBkDZhCVNaIF5NL1GehsEF4fa5bEJ5QchaAZfgAq3us9 uKpGkKxuSo4WSwAIknpyEXwkQFCzgQ4f7ix7Q+DoMUhNHReyjHpAk/RjxwLy5QVmUwSs boJgALCvECWpZb/QdzAtnOD8gJPEuwrkk06yMuE6pW9qh0yvLYfZ7PxKmOzN86aXzp+a p0W/ZlWutuOqkb7tVgwIURl18ulI6j9Fh86cw2FN5SXNPSGmwzQ9Yad8Gwcc4I2PC6w3 UHVPQwG2250q+tBMM/hgQtabQELJCQCpMTS3IVZKzCqh+mB1mq2ddh0uF0qy48SppQXB 5bgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=DF8fvztd; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-51980-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51980-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com X-Forwarded-Encrypted: i=1; AJvYcCX21r2ZxgEuEEQJP7okU7UjCvAxcoDVatK74xOLKGFQftuoPPQDiwnk8l8JX7ldQvMg2g8jCQbj3/oNWBKOQdxY4AhsuVHSGV740kSAkg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a15-20020a1709062b0f00b00a376328ee38si1964419ejg.125.2024.02.04.18.06.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 18:06:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51980-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=DF8fvztd; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-51980-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51980-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1706E1F2211F for ; Mon, 5 Feb 2024 02:06:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01F928F47; Mon, 5 Feb 2024 02:05:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="DF8fvztd" Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70A3F79D8 for ; Mon, 5 Feb 2024 02:05:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707098752; cv=none; b=mju1mQQ8uhWC++fQZUCdbF90N1RcKWtsZ9739s8h+KYWzdsK+9miKgbAe6H990xluNTriFcvOMPQ1nz0nSqhSEORDca6gKMcTFjfK9PSDUsm9J+814rDrf7lKp3o60qyXGB5x0BDndzOS0jXHPq9WLwuv+rxOfgX2+0p483azIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707098752; c=relaxed/simple; bh=5XwGgmp3BPmDJ0fpZR5jpmy1vISiDiiwafuKouHj0Wc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jxyQxnydvBewUBONIvN9CNZQiWTyW/1eWv3wpMWFasU7BiCArPBLXHunChzuhE1IbnmqdX1Mm5JWzhxjrSFJv+FyXBmBLNGlPn0g0SROBSZNfCODrFEWKoAfDWvbgsBEI939ka/1OQCF2bkMahX3DTANXPAJYwf994U8I/XnLpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=DF8fvztd; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5dc13b142ffso418859a12.1 for ; Sun, 04 Feb 2024 18:05:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1707098749; x=1707703549; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=O+8ijc4eH6dLtZNsmA9IMPtPI2LG666HTBs74Wzg/oA=; b=DF8fvztduKDHbwxVElTu+5bf3wh7r1kQ5rK5yvVhkjhMU66RwVhkIHLzFrz0fhnzdz UfAVI/q/J46tRSUr4g3A0roLFeP7ozbj3wdOBN1ZCVyGjp6b1+YsbOzmYbFTtU0eaVVC BNCpPyu7mEVdnJlNIgJSPgtNJOMKaHdRzTYMnw02h1lzBs25pg45+Dy7+Ak2fAHz7iu7 QkkMZX2f4I+5Gy2T4rsDI2RBe2ZmtRUrrTZzQW/T5v9iRWZOJhiU7JL8DG5ceOH0Mj3q 7LSvO8hoPR2Aybjhfsy9WcIPO0+O2emlpAyNIZgD0pF0ZQu7qu2RQeOOldoWkVt7cfqq +lqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707098749; x=1707703549; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O+8ijc4eH6dLtZNsmA9IMPtPI2LG666HTBs74Wzg/oA=; b=DfKoqjbET6K8IXXAxnt9e5Cxc/GbR88rN1XoHdNlT2eCS+oeJJDkZNd/G5oLAZLtw+ Dk9dh7YYb5xvpOIXpgP1hA8q/4gc5A5m7zd1TcKTDZOygp7PKzxLurRXEckufQZs49Xz Ap82oUdsMJu1DQhbsg1+CKXE9t4iaVrPKdrQ8K+uF6TmP1InqTR9OqmP0yhReeNNLJ2F NHYYOln6nasz7PseTAwGwZUB/YB1Zex0+v1P0kfA73En0yKYFa7VTj+Ts4lqXK3nD82g 7x5k/0LATUwFItZnkPEkj/OB/orNTX+rU1VdUKaVJsh/xuhrSbrU+ukt78y9waqZGkJm ibhQ== X-Gm-Message-State: AOJu0YzCOkQs7rK84CJeBSO+GHvgXePKyRlm9wwUb/XfTemvPqmHbtKB uRXcycXCMM5REQdaVV8+JfbdZeDhsQG2p/OrlVefhtxBNYEnfL+bn/QnTKRivJc= X-Received: by 2002:a05:6a20:1441:b0:19e:317c:b353 with SMTP id a1-20020a056a20144100b0019e317cb353mr15150270pzi.2.1707098749629; Sun, 04 Feb 2024 18:05:49 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVspSycYoIEXn4EgPZz7USoAoUFNLMU/8YDPVu6q/bF+OElJehghZkpfpgkoSsXTccwcG7aH9mG22TmU81aGJgC1CzbACMVutQROUUnzkgl+HummRTkXxn+DImzjz4YgmIJM6sT2hOuMKBNi9AxnraUSFPW4Gih3sg2+BZcDSHDqEEsrnbGVk/6EwO+So0Z9RpIi8o2ugDeLG/Kqum/1eTpZ+GYE6W1eRXia+S2qz9JZGCUsJ0= Received: from [10.255.134.6] ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id mn16-20020a17090b189000b0029696f7f443sm966122pjb.50.2024.02.04.18.05.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Feb 2024 18:05:49 -0800 (PST) Message-ID: <7fad74d9-134e-4606-abf7-3969ca01acef@bytedance.com> Date: Mon, 5 Feb 2024 10:05:42 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] mm: pgtable: add missing flag and statistics for kernel PTE page Content-Language: en-US To: Matthew Wilcox Cc: akpm@linux-foundation.org, arnd@arndb.de, muchun.song@linux.dev, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org References: From: Qi Zheng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Matthew, On 2024/2/5 02:51, Matthew Wilcox wrote: > On Thu, Feb 01, 2024 at 04:05:40PM +0800, Qi Zheng wrote: >> For kernel PTE page, we do not need to allocate and initialize its split >> ptlock, but as a page table page, it's still necessary to add PG_table >> flag and NR_PAGETABLE statistics for it. > > No, this is wrong. > > We do not account _kernel_ page tables to the _user_. Just because > the kernel, say, called vmalloc() doesn't mean we should charge the > task for it. Moreover, one task may call vmalloc() and a different task > would then call vfree(). > Got it. Thanks for providing this information! > This is a can of worms you don't want to open. Why did you want to do > this? Ah, just because generic {pmd|pud}_alloc_one() has opened it. ;) And When I looked through the commits (e.g. commit 1d40a5ea01d5), I couldn't find the information you provided above. And that is why I CC'd you to double check this, in case I might have overlooked some important background information. So we should actually fix generic {pmd|pud}_alloc_one() (and maybe some implementation in the arch), right? And it would be better to add some comments to clarify. Thanks.