From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05DFBC52D7C for ; Mon, 19 Aug 2024 02:38:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89B116B007B; Sun, 18 Aug 2024 22:38:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84BD06B0082; Sun, 18 Aug 2024 22:38:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7134B6B0083; Sun, 18 Aug 2024 22:38:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 523B06B007B for ; Sun, 18 Aug 2024 22:38:12 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0080180CCE for ; Mon, 19 Aug 2024 02:38:11 +0000 (UTC) X-FDA: 82467435624.12.EF45DC2 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by imf17.hostedemail.com (Postfix) with ESMTP id 172394000E for ; Mon, 19 Aug 2024 02:38:09 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ONWrHiWf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.222.172 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724035033; a=rsa-sha256; cv=none; b=eWgm5n5x6cd2tyx04rKXlYTCvujkX0Dni53MymU4Q1m/bUnRG4faM6RKhsZvzgOsztEmd5 2jd5uBqoCgR1cJtkVbLmhmL9LhXB6k/ea4Od7KZkxedOFjlDPf8q1nyjrIzieukPxHKiSS dpJGCJ7NsDl7z9sxT1DEdyumk+4x408= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ONWrHiWf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.222.172 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724035033; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mI0z4qbYhXzeJGZNJKFvenZKA1XOL8A95IrbXV4PtLM=; b=mGCBirBnTg+JSh+WDZLgTAWfvedqVy/i5gJbYyBIqtzuOihrI2g6BmemsDltnt+L9VcoAw Rp2oPkunmCcU+ArDHEwce0aq/hdZaprlnJqZVQcOki2IT4Vs2U6P53dN07ZGSkviwfB5XH GaELUVK0uAXSU1pTid+hnchhs3xmQLs= Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-7a1d6f4714bso388576885a.1 for ; Sun, 18 Aug 2024 19:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724035089; x=1724639889; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mI0z4qbYhXzeJGZNJKFvenZKA1XOL8A95IrbXV4PtLM=; b=ONWrHiWfw1ja+yPo3jSwg97ek0XGmQG91Elwn2SiW5AJ2kgGy44XkBtLbEWfl9jh6W +G8wOL1kC5Q+b8KXw0IeaQR0064rUPd4IzFpNHCkPwhCgoVVc1zgUpcks6mPrEXeL9cG qtBPimv4AfkRZso8FQpEUQ/J7Gt7xAqKcoNL2f/0v7LwpjV4jlqihotz0icT6lefoBBZ A6dWLbCQzmkG7bDYzzuBfIrpUnrAE4YompG7BApIptY/07CgDSurRJCncRHxcZTY/Xdq +tCe4pGpZrhlONB81z+dp4DdnijMdjQS0cmzBHN7uW3LvTwYCB2LR+2Y8Iq3jjgalthV ZdkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724035089; x=1724639889; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mI0z4qbYhXzeJGZNJKFvenZKA1XOL8A95IrbXV4PtLM=; b=vkIQgpSp1u/N4mtElXUvO9uZoZomCwCfphRcHz1w7E7OV/QVbWEPULc9G02EPzdRkX TdIBpivDmw0zYi7jzwafIUJ5RONlo0JT7Ibt6GsgYZyFtgzlEsz+V/KsFcW3FA8R3RmY /ifQ4PsFi7a3M26u/o7GdkmfU1cYXmrJL7Cw7uVv+8tBN7e0lz4Ji5aaYrLH1cu5GgdY bJ7vTo9lzEwe8dF7z4QpAgpqaY9jvzumgmlN2okmTX1UnaTqssrZKArJ510QZ33kMGwB e27N+p5TAmSZ6MPbL980t0i3tYB4O1hHBhC4ZvIxK6rV7EkkTt/Z4NYqXtZpNp3LClRY UdcQ== X-Forwarded-Encrypted: i=1; AJvYcCXp2Fch1ZB8OVte8pRT6RYFEaqgdjdiLf+mMnrn53xoEHioQB9jzhkDykZ+9P+zkFtB4rpXC+ToUsdx5F3/Klm8Goc= X-Gm-Message-State: AOJu0Yx/i0rSILNIl9T5tKXaZ34Ne/1qZ7wt9hx9bTtNyIoGLT40MoIe 90Hw6+eRUJc9cYweZLGfzfoFwXuhMIbJTJ3Xu2ifczs42Ln+F7Qv X-Google-Smtp-Source: AGHT+IFZ49myeyGjxznVH4Zu0OvbTU5lWVEtVJuZ1O+hjGUExG8VO6LdaznL6XBwEaQJU6VLBIrF4g== X-Received: by 2002:a05:620a:4013:b0:79f:72f:2c60 with SMTP id af79cd13be357-7a50752170bmr1480619885a.26.1724035089090; Sun, 18 Aug 2024 19:38:09 -0700 (PDT) Received: from [172.20.6.203] ([64.20.177.247]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff02b0c2sm396204985a.22.2024.08.18.19.38.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Aug 2024 19:38:08 -0700 (PDT) Message-ID: <3938ed07-9473-4210-be44-74e518fd31c6@gmail.com> Date: Sun, 18 Aug 2024 22:38:07 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 0/6] mm: split underutilized THPs To: David Hildenbrand , Hugh Dickins Cc: akpm@linux-foundation.org, linux-mm@kvack.org, hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev, roman.gushchin@linux.dev, yuzhao@google.com, baohua@kernel.org, ryan.roberts@arm.com, rppt@kernel.org, willy@infradead.org, ryncsn@gmail.com, ak@linux.intel.com, cerasuolodomenico@gmail.com, corbet@lwn.net, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kernel-team@meta.com References: <20240813120328.1275952-1-usamaarif642@gmail.com> <1e6f3b38-d309-e63f-bca0-5093e152f7d7@google.com> <19b1c8e2-f60e-460d-8249-5db71a708dc9@redhat.com> Content-Language: en-US From: Usama Arif In-Reply-To: <19b1c8e2-f60e-460d-8249-5db71a708dc9@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 172394000E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 5h85o5nhk56mk7knq9sdfr5691phgzkc X-HE-Tag: 1724035089-299402 X-HE-Meta: U2FsdGVkX1+i4pu0v4mmDPZrEcHmIvHHjDSGkUX3v8tb7q41KRXYzBADnDKfFrNlaNSyAG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UpVL6afpUNW/hMy16V6wndjTzrOseVy7GicJKjcGpEd81jgorw0chY6zAkSqGeuHKz/LdsyUKiPjF2QgOvb61tbn2bpH2W7S/Ynf4NmTpz5/0C2iruegEE8H6j8Oh6uxgJcvL7em8w5qGB1tEgHUTZAJfeZq9n6pN3LOXHRhqhQwmy67pmO0RsZ+8UyHG+WZLOAEER2lyBmZ2hFb8TF7tRKoBsWfHJHSdnyq8Yv26glGYMSqQ3rp8lLYunPonRu/5mMeDSAeQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 18/08/2024 08:45, David Hildenbrand wrote: > Hi Hugh, > >> 2. I don't understand why there needs to be a new PG_partially_mapped >> flag, with all its attendant sets and tests and clears all over.  Why >> can't deferred_split_scan() detect that case for itself, using the >> criteria from __folio_remove_rmap()? I see folio->_nr_pages_mapped >> is commented "Do not use outside of rmap and debug code", and >> folio_nr_pages_mapped() is currently only used from mm/debug.c; but >> using the info already maintained is preferable to adding a PG_flag >> (and perhaps more efficient - skips splitting when _nr_pages_mapped >> already fell to 0 and folio will soon be freed). > > No new users of _nr_pages_mapped if easily/cleanly avoidable, please. > > I'm currently cleaning up the final patches that introduce a new kernel config where we will stop maintaining the page->_mapcount for large folios (and consequently have to stop maintaining folio->_nr_pages_mapped). > > That's the main reasons for the comment -- at one point in my life I want to be done with that project ;) . > > folio->_nr_pages_mapped will still exist and be maintained without the new kernel config enabled. But in the new one, once we'll detect a partial mapping we'll have to flag the folio -- for example as done in this series. > > Having two ways of handling that, depending on the kernel config, will not make the code any better. > > But I agree that we should look into minimizing the usage of any new such flag: I'd have thought we only have to set the flag once, once we detect a partial mapping ... still have to review that patch more thoroughly. Yes, the flag is set only once, in deferred_split_folio once we detect a partial mapping.