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 7DEFBC2BBCA for ; Tue, 25 Jun 2024 17:20:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8D286B0088; Tue, 25 Jun 2024 13:20:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CEE966B0092; Tue, 25 Jun 2024 13:20:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8FB96B0095; Tue, 25 Jun 2024 13:20:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9879B6B0092 for ; Tue, 25 Jun 2024 13:20:46 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 358C0C03A1 for ; Tue, 25 Jun 2024 17:20:46 +0000 (UTC) X-FDA: 82270075692.10.9D38B38 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by imf26.hostedemail.com (Postfix) with ESMTP id 4F98D140006 for ; Tue, 25 Jun 2024 17:20:43 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=NbFLQKnc; spf=pass (imf26.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719336036; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5sRWgIsDN9rxxK/fFSv124QkLdHj/Xm1vNPLxyytvHg=; b=fUF8oKiqKVW0u/wZb2XcI1kqc2g0aHGwiiHkTKTZy+C58WLxddRFV5GpmBzMLZmcS4SkFe c4Ifkim83BlwUw4UNjd5fDeEt+TJfvpbEyxWEMEr7JNOuy554N0quen81tW37z9yBxFHTA g10wYj3hZb+ZIAH5JO7SUnanbSiGFHA= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=NbFLQKnc; spf=pass (imf26.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719336036; a=rsa-sha256; cv=none; b=LYSHlaMB1AvVOIlA7FGBTop4HEbZzxkFAOT413/qZs0dEfKau8pSdK9zmAk7tVNF4nt7d7 I/ANuOcMy+oIijPH4pY8W9REUKhNs8jOYJAOUoj38tnr8slN8MzazZ+wTrd3EumUww7ODl diYuyTAoaKm1WHzHoYRJ0EslJd3bjEo= Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4W7s6Y0nJ7z9shY; Tue, 25 Jun 2024 19:20:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1719336037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5sRWgIsDN9rxxK/fFSv124QkLdHj/Xm1vNPLxyytvHg=; b=NbFLQKncW0PDy/nuxq7Qj2mWHIOZmfmzKWUYbHxAcG3KETJdt8sa33BCfGHmXSfOVFQvrM 1qnBIvI0tOS8yRKFcipEMRuyw0/KogZXNqLFqc6sfg9vopGxoci7uTq/CJrAQ9JVv94qiM +LtspHT+K83wtDVVyPr1lNFdnPtRD5+JAXMHK3C3tBdD0iXynEpTbKlXxUWE4mBcVHNlIV 4W/FqcDOHE0GDo4ISYViERy9biN5rKmRS+4mUMu52duVNFbvqHjheOPBlgbxzug6RQYg6B I3ezacJV7fsESDZtPNmZ+YHrFifPplxNiTu309eyBx8Vpr9i+iA/oX4nb0i1Kw== Date: Tue, 25 Jun 2024 17:20:31 +0000 From: "Pankaj Raghav (Samsung)" To: Zi Yan Cc: david@fromorbit.com, willy@infradead.org, chandan.babu@oracle.com, djwong@kernel.org, brauner@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, linux-mm@kvack.org, john.g.garry@oracle.com, linux-fsdevel@vger.kernel.org, hare@suse.de, p.raghav@samsung.com, mcgrof@kernel.org, gost.dev@samsung.com, cl@os.amperecomputing.com, linux-xfs@vger.kernel.org, hch@lst.de, Zi Yan Subject: Re: [PATCH v8 04/10] mm: split a folio in minimum folio order chunks Message-ID: <20240625172031.y5yyukeudinescxk@quentin> References: <20240625114420.719014-1-kernel@pankajraghav.com> <20240625114420.719014-5-kernel@pankajraghav.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 4F98D140006 X-Stat-Signature: tukthq34ruh6x3cxt93zcdprdsuhw5je X-Rspam-User: X-HE-Tag: 1719336043-423097 X-HE-Meta: U2FsdGVkX1/l3gDM5OKFBDmHXRpyUFlteh/YWSmCsCXoTxDcwCmFbrLQrW/p4sg3XZxSpY+zWQW+lvFgVWAF0vqIHMxLJVl61ZbkyU8bcgb4OsWrKBHx0A2IRbZE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XagSZ664IWsnlw7J74zpRHKnKHYpIZJ1VA8BWi3qacM15yExc0GnXA1epyLQPC1C1ZrCoZmaJrC7ZuRTLh6T3ZWs= 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 Tue, Jun 25, 2024 at 10:45:09AM -0400, Zi Yan wrote: > On Tue Jun 25, 2024 at 7:44 AM EDT, Pankaj Raghav (Samsung) wrote: > > From: Luis Chamberlain > > > > split_folio() and split_folio_to_list() assume order 0, to support > > minorder for non-anonymous folios, we must expand these to check the > > folio mapping order and use that. > > > > Set new_order to be at least minimum folio order if it is set in > > split_huge_page_to_list() so that we can maintain minimum folio order > > requirement in the page cache. > > > > Update the debugfs write files used for testing to ensure the order > > is respected as well. We simply enforce the min order when a file > > mapping is used. > > > > Signed-off-by: Luis Chamberlain > > Signed-off-by: Pankaj Raghav > > Reviewed-by: Hannes Reinecke > > --- > > There was a discussion about whether we need to consider truncation of > > folio to be considered a split failure or not [1]. The new code has > > retained the existing behaviour of returning a failure if the folio was > > truncated. I think we need to have a separate discussion whethere or not > > to consider it as a failure. > > > > > > > +int split_folio_to_list(struct folio *folio, struct list_head *list) > > +{ > > + unsigned int min_order = 0; > > + > > + if (!folio_test_anon(folio)) { > > + if (!folio->mapping) { > > + count_vm_event(THP_SPLIT_PAGE_FAILED); > > Regardless this folio split is from a truncation or not, you should not > count every folio split as a THP_SPLIT_PAGE_FAILED. Since not every > folio is a THP. You need to do: > > if (folio_test_pmd_mappable(folio)) > count_vm_event(THP_SPLIT_PAGE_FAILED); > > See commit 835c3a25aa37 ("mm: huge_memory: add the missing > folio_test_pmd_mappable() for THP split statistics") You are right, I will change that. I didn't notice this commit. > > > + return -EBUSY; > > + } > > + min_order = mapping_min_folio_order(folio->mapping); > > + } > > + > > + return split_huge_page_to_list_to_order(&folio->page, list, min_order); > > +} > > + > > -- > Best Regards, > Yan, Zi >