From patchwork Thu Apr 25 11:37:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13643182 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 964BAC4345F for ; Thu, 25 Apr 2024 11:38:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2688D6B0096; Thu, 25 Apr 2024 07:38:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F09D6B0098; Thu, 25 Apr 2024 07:38:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0942E6B0099; Thu, 25 Apr 2024 07:38:18 -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 DDD526B0096 for ; Thu, 25 Apr 2024 07:38:17 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9BD351A042A for ; Thu, 25 Apr 2024 11:38:17 +0000 (UTC) X-FDA: 82047855834.05.CAAA025 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by imf14.hostedemail.com (Postfix) with ESMTP id 99551100010 for ; Thu, 25 Apr 2024 11:38:13 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Z0huUBl7; spf=pass (imf14.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=1714045093; a=rsa-sha256; cv=none; b=oK1zqygLCUfCGbbCQ8UweVV+OTk47c8fXAmY+Effrf0NcFIU8T2xTnFRvzqk+j39a4UKm0 cwpwohsBrd3CGNiKqvgvsRRkLW2Y4SQ1mokgh2gueoRnRTyw7I9trck87ZXdABSSZ4VnJ3 ganEowS6RkJIK5/WZ2+qwZgprt4RN78= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Z0huUBl7; spf=pass (imf14.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=1714045093; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4fVr4b9yY0BnR40etXyUF6I1OzhNW3adroiSkIr7JfI=; b=NrvHxbjouxFselythHYSlOCrYItfciXDrqNUeGR5lqfnS6P5LRy75ZfD+3kprS/K2rx7+c adznv92HknRLWmaB3Dp5NFTMUTJq4I30n4eAWHbEG8kvjnUeVEP29hItRdaoCK7Ej3ZLWH aXCrTW0V9ksn7QBKR1ZI8WfYrcN6/mc= Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (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 4VQDPZ0yvLz9ssM; Thu, 25 Apr 2024 13:38:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1714045090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4fVr4b9yY0BnR40etXyUF6I1OzhNW3adroiSkIr7JfI=; b=Z0huUBl7vPYkwQXuGJvayILrp8fqw1XoWWWGfZA54Jz3eGBIbjPv2tzkb8U2hzLbN9kbzH CBVqCH1M87ltsgLZgkAJDtRtQTRwDdciiRm8HxJazZR48lp0lxZ0HZ8xH80ehB/Wf3AoJN KAh4mmedJIL72xLuMNS89gd6IW+Lksmwj+8MN4t+fBP+/YCC/PcX+i5CO1HDAW2CxtGWAG hdYShbikqRUAeOGRKvcwOevAF3K5a5ptRScXTkN4OOAADyrRpBA9eZ0HXPI8lSfNdVd5rm EGAr6TPGPpBEx6EBqTDWeGxgwBtvn53q1W5q5/KLLowSAgqffxK5VDdfhFhgcg== From: "Pankaj Raghav (Samsung)" To: willy@infradead.org, djwong@kernel.org, brauner@kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, hare@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, mcgrof@kernel.org, gost.dev@samsung.com, p.raghav@samsung.com Subject: [PATCH v4 05/11] mm: do not split a folio if it has minimum folio order requirement Date: Thu, 25 Apr 2024 13:37:40 +0200 Message-Id: <20240425113746.335530-6-kernel@pankajraghav.com> In-Reply-To: <20240425113746.335530-1-kernel@pankajraghav.com> References: <20240425113746.335530-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 99551100010 X-Stat-Signature: cr7zfa9p964u8omhc17ggk95iu3ms6kc X-Rspam-User: X-HE-Tag: 1714045093-546529 X-HE-Meta: U2FsdGVkX1+FeOQG7PWEuRewOZz4Q6b7T9AqXeHgqJI7Q68FzlKvITrH+nY/yhumn34B64F4WFXD5QB4SAEZTf1GEPoAR7IHKIj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989Y0J3T9Hre7Dmpj2EcWMoz30JQXyujTa3+i5Ce1XGKOGl6f67OPGmX0eLm6ibzELGiPjIywJVXEIXJcHCdElKq5J7CZjAc0f7cggPV4Ul5Ico1KlZDk5Kcb0A== 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: From: Pankaj Raghav Splitting a larger folio with a base order is supported using split_huge_page_to_list_to_order() API. However, using that API for LBS is resulting in an NULL ptr dereference error in the writeback path [1]. Refuse to split a folio if it has minimum folio order requirement until we can start using split_huge_page_to_list_to_order() API. Splitting the folio can be added as a later optimization. [1] https://gist.github.com/mcgrof/d12f586ec6ebe32b2472b5d634c397df Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain --- mm/huge_memory.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 9859aa4f7553..dadf1e68dbdc 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3117,6 +3117,15 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, goto out; } + /* + * Do not split if mapping has minimum folio order + * requirement. + */ + if (mapping_min_folio_order(mapping)) { + ret = -EINVAL; + goto out; + } + gfp = current_gfp_context(mapping_gfp_mask(mapping) & GFP_RECLAIM_MASK);