Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp757537lqm; Wed, 1 May 2024 15:06:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV2dqN8MPEmu8Yjo/HTfQgmnBgs/C3M+88ZJQy73bHrR1x5bF0aQeXmP2lCKWHU7K4/kcV82fyIR3Rlx5hnaur5HPCaE4dI6R5W0IKkyw== X-Google-Smtp-Source: AGHT+IGinBnQP+XXTfKE9pPEIgsF03HHsEkSBd2jK7Q8ZPnXIFOnblAHjG6anV+KXDO4Uy6Z2uZo X-Received: by 2002:a05:6a21:3a42:b0:1a1:878d:d3f6 with SMTP id zu2-20020a056a213a4200b001a1878dd3f6mr4305555pzb.26.1714601182870; Wed, 01 May 2024 15:06:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714601182; cv=pass; d=google.com; s=arc-20160816; b=pNMuQZXJ6lqJ5J/K16yLvX4w5A2X30uyIfAO9q0EKp7/wVXxGQFceLUFQIiXvOEnEk O1H12f8+uDQW3kln6SfdHGJFMODHkq+7HzU/1B2b+xkJePolaIdtJzkuCo27LERGuxJa 01BrNM+YvHnoLI5nRQ06QlB1ZI5g5sBQHzT6OdXx/iW+FLSqImFP6VpZMTjzKPORoShz 8S8h0HfRgzH6eDMdfrtqf7ta+P+Oect9LA5Rju6KUDEmrWVNObeZS1fbRp4CF6D9GCxr /zQ28IdGSC3CJvgG9hWtmyZBG0WLOtBWeqia9P0IKDJew6udCxbENGXYbKGeZaO2lmUx VbJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=sm0RzHylR5Zw9bOYvZFFoHhRX899/0BlSNXO6Xo2wxI=; fh=pF8O8ZlhM93HG/YAQmbRtfEa+p/2PKVw4jiGuw5lqzo=; b=Mpacc/eEr8w4L+u5Roew3ZJzyyZiL7xtl6g+0Q8o3c7c76xTa5+Iv5dqeudP5PwMck vNPdqlZ5CiRRWzDAcB5JANf6Ql8QGi05dIf2Gq0vD6OthdbMyonA/1GgBA1xCvs8BH+6 qXgTESOR+q8MnlW+cl9fKbCfnbMBbnqX+bQvMpnEksbJBP2K3FKyLm+pq6DHIyKtrbs0 AStsa1KcuDFGZvDiezy2b6NrNgRQDpXex4W5KRlB0wOZ1P0duIou6FLlfglpjPA4rY9x nKnUUKh+d4rYqLVBiTxPtiAJEQxna6MWlb9coUGcMQV/ynAnvfBXNEgEoItKq9Mv74aX q9nQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=PUA60mfw; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-165783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165783-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e6-20020a637446000000b005fd4b58f729si19976390pgn.452.2024.05.01.15.06.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 15:06:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=PUA60mfw; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-165783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165783-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 818C02851F2 for ; Wed, 1 May 2024 22:06:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2621165FD7; Wed, 1 May 2024 22:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PUA60mfw" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC3DB1649A8; Wed, 1 May 2024 22:06:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714601174; cv=none; b=BMju/YlitrRB4m6FKMByVfEUVlPnrdcDk91BDgeJ7weOHcUuZTZfxc8FilmLXfdBeUI8WheGveD3CgMP6bMevTit0TuSP1d9/feVvGat7J6KQ0eMf7/fphP36cftry4IC7iAMnab8lLHWUkDTHzdU9uMei2DK0qfKd9TQ24v+z0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714601174; c=relaxed/simple; bh=h5/Bf9TDZQL4DKdeJo0EsruEaQY9edKPqbpWJiW44JI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BEIfz2kF9vMgNVc0q6T6TOuzrahJ/ok3fqi/hj9hWXq7eVvLMv0i6rsD7qMW5q+fBzBnzrPVhfNW6SVH4jfd3TfZakfDL7KwzQ9ZIWk+/6qlJcJIBzlS0rTWAgxrNzKToH+J4/al6NwXUTehCeEtmqDo5qAiHKipATqTY/QApnc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=PUA60mfw; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=sm0RzHylR5Zw9bOYvZFFoHhRX899/0BlSNXO6Xo2wxI=; b=PUA60mfwCcmYT5Y4hGx/5oenxS JcgVYk8xSO4t/Iktb2IEdf8FSfSP5/+Q8uDWlEt1sAyG7YWVLHmfAw2CXARVf6u4dktB7l1dL9npd pEg2ZZyTdDRg9wU+MDdQw7nB3mo5S7kbH2/ioilACesFLIop/JtDuSx0hWYimDbEKebt6gjNArEXR 3rJ9rqMmv8QCYyFDivehLSsg1UU3vIwj2QhAU/j40xmLMfO96RwOHc20ZgmbR6YfPaZSVGWJ78LJE Fm9IS2M355V6DPt0w4Gyckjp+iGMaYPGbuCCee1w9RcQvl+S2jQHq4Dew4HKLYFQbiXZZMMl03QDM oa7yPR1Q==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2I5U-0000000Amjt-1n7n; Wed, 01 May 2024 22:06:04 +0000 Date: Wed, 1 May 2024 15:06:04 -0700 From: Luis Chamberlain To: David Hildenbrand Cc: akpm@linux-foundation.org, ziy@nvidia.com, linux-mm@kvack.org, fstests@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, willy@infradead.org, hare@suse.de, john.g.garry@oracle.com, p.raghav@samsung.com, da.gomez@samsung.com Subject: Re: [PATCH] mm/huge_memory: move writeback and truncation checks early Message-ID: References: <20240424225736.1501030-1-mcgrof@kernel.org> <37374089-895f-4c6f-a2f5-33859eb02b13@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37374089-895f-4c6f-a2f5-33859eb02b13@redhat.com> Sender: Luis Chamberlain On Thu, Apr 25, 2024 at 11:40:48AM +0200, David Hildenbrand wrote: > On 25.04.24 00:57, Luis Chamberlain wrote: > > We should check as early as possible if we should bail due to writeback > > or truncation. This will allow us to add further sanity checks earlier > > as well. > > > > This introduces no functional changes. > > > > Signed-off-by: Luis Chamberlain > > --- > > mm/huge_memory.c | 23 +++++++++++------------ > > 1 file changed, 11 insertions(+), 12 deletions(-) > > > > While working on min order support for LBS this came up as an improvement > > as we can check for the min order early earlier, so this sets the stage > > up for that. > > > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index 86a8c7b3b8dc..32c701821e0d 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -3055,8 +3055,17 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, > > if (new_order >= folio_order(folio)) > > return -EINVAL; > > - /* Cannot split anonymous THP to order-1 */ > > - if (new_order == 1 && folio_test_anon(folio)) { > > + if (folio_test_writeback(folio)) > > + return -EBUSY; > > + > > Why earlier than basic input parameter checks (new_order? > > Sorry, but I don't see the reason for that change. It's all happening > extremely early, what are we concerned about? > > It's likely better to send that patch with the actual patch "to add further > sanity checks earlier as well", and why they have to be that early. It's a clear eye-sore when we add min order, I'll leave the eyesores for others. It can wait. Luis