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 865F0E7718A for ; Thu, 19 Dec 2024 16:09:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1659D6B0096; Thu, 19 Dec 2024 11:09:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F0176B0098; Thu, 19 Dec 2024 11:09:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5C7E6B0099; Thu, 19 Dec 2024 11:09:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id BC9BF6B0096 for ; Thu, 19 Dec 2024 11:09:10 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 49639121464 for ; Thu, 19 Dec 2024 16:09:10 +0000 (UTC) X-FDA: 82912191894.12.918F6C9 Received: from fout-b2-smtp.messagingengine.com (fout-b2-smtp.messagingengine.com [202.12.124.145]) by imf30.hostedemail.com (Postfix) with ESMTP id BBC188000B for ; Thu, 19 Dec 2024 16:08:04 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=fastmail.fm header.s=fm2 header.b="yGaY/irh"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="Q hXiwXe"; spf=pass (imf30.hostedemail.com: domain of bernd.schubert@fastmail.fm designates 202.12.124.145 as permitted sender) smtp.mailfrom=bernd.schubert@fastmail.fm; dmarc=pass (policy=none) header.from=fastmail.fm ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734624511; 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=mek9gh2qCnrmwkTbLZwTrAHm/dw3ZHqNhHYFkkmDqS8=; b=pwx5YT/IqpsQhofUr+LZE/YF9+ITm6bMJS1WzIXS3hB0aioqT+1piLw9nM8JtKmwL71oYn FNCVUMLLN3YlvxNsdl2FGCsDbkjUzXN3FLNWubz7euXeRSUC/eUtLn1Gkw0XbZIJrB5KnH lxTRvD+edEebTJx/tkOBTJ9fLAsIB4k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734624511; a=rsa-sha256; cv=none; b=yMQQfLsntk3SgvDo8C7Q9xvidrW1tbSIE78Qm9+3udV1MRdz7N68J7k4dqKrqamo5u/MZC GcsYmnRg8lpQh1JaynrjqT8m+ysvlM/GW6rFrvq/WfupERlZhWLlf6o1DPyr7hblu85kX4 x5tLbhe4/Vo9AUtX3aRgH8zXiLvxaqY= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=fastmail.fm header.s=fm2 header.b="yGaY/irh"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="Q hXiwXe"; spf=pass (imf30.hostedemail.com: domain of bernd.schubert@fastmail.fm designates 202.12.124.145 as permitted sender) smtp.mailfrom=bernd.schubert@fastmail.fm; dmarc=pass (policy=none) header.from=fastmail.fm Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 2E991114013F; Thu, 19 Dec 2024 11:09:07 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 19 Dec 2024 11:09:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1734624547; x=1734710947; bh=mek9gh2qCnrmwkTbLZwTrAHm/dw3ZHqNhHYFkkmDqS8=; b= yGaY/irhR2I2mVPcVI4vmxEz7Jp/9ytly7MsNm6WtZFkMn2QbAoCDXeokSdCdM74 Yso+KyfleYbojnFwsljhUv68m6KO1DcC7ecsIn0vdWUnNwhDrHn74KY7RF9hvNNf HD/W81dH5Ff7fyrjEUN6XubTwEWkdIemtQMbo9zMBrXKXFfYAoBhFe37u60F6UZL jLV3LHZnMJDWd+cXrA0kUEEu2P7rt685llNya1pnc3NZ5Mc1KOtWxfFOMypjhCBo 1LPHZcG2R+nIboi87ZLqLUMNnVF4Sn1aZDa4oPrr8NWxntPjj8Vr6lhwzq//OA4c ij5aJ+Wbk6U/WTVtnphsaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1734624547; x= 1734710947; bh=mek9gh2qCnrmwkTbLZwTrAHm/dw3ZHqNhHYFkkmDqS8=; b=Q hXiwXe+GEby1kpRmgcBaZTbCyPDNetoGLaC8OGQeG7Nl8if3kYxURw+9OoexlvwV 2VNoQHv2+UldafDQyX4U6oJ2Nhezag/HhQMo+lQIV9T7Zzhh/s1zEV0MIPtGEqCS fje+78Hl6Ge91izsjAbJsZ9vfg2bWCN4cKEUol37Nro2rWPgxrzK+HX9N8ORvA8o Z4UAxRrC0TRTCp+s00+qNjVBihvMt6DCS+x7bZZ7xXJWBGJp5oSzWDPuFILXhCTZ 6rHP++nBtcZVUKC+Qw/K+TacoeQCiAsB7VdM/P/SaNULPdkrvpvKH+ZD6293gCNE aRjS6ji74pJ6Fsm1/HXEQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddttddgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeeuvghrnhguucfutghhuhgsvghrthcuoegsvghrnhgurdhstghhuhgsvg hrthesfhgrshhtmhgrihhlrdhfmheqnecuggftrfgrthhtvghrnhepvefhgfdvledtudfg tdfggeelfedvheefieevjeeifeevieetgefggffgueelgfejnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsggvrhhnugdrshgthhhusggvrhht sehfrghsthhmrghilhdrfhhmpdhnsggprhgtphhtthhopedufedpmhhouggvpehsmhhtph houhhtpdhrtghpthhtohepiihihiesnhhvihguihgrrdgtohhmpdhrtghpthhtohepshhh rghkvggvlhdrsghuthhtsehlihhnuhigrdguvghvpdhrtghpthhtohepuggrvhhiugesrh gvughhrghtrdgtohhmpdhrtghpthhtohepjhhorghnnhgvlhhkohhonhhgsehgmhgrihhl rdgtohhmpdhrtghpthhtohepmhhikhhlohhssehsiigvrhgvughirdhhuhdprhgtphhtth hopehlihhnuhigqdhfshguvghvvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghp thhtohepjhgvfhhflhgvgihusehlihhnuhigrdgrlhhisggrsggrrdgtohhmpdhrtghpth htohepjhhoshgvfhesthhogihitghprghnuggrrdgtohhmpdhrtghpthhtoheplhhinhhu gidqmhhmsehkvhgrtghkrdhorhhg X-ME-Proxy: Feedback-ID: id8a24192:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 Dec 2024 11:09:03 -0500 (EST) Message-ID: Date: Thu, 19 Dec 2024 17:09:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 4/5] mm/migrate: skip migrating folios under writeback with AS_WRITEBACK_INDETERMINATE mappings To: Zi Yan Cc: Shakeel Butt , David Hildenbrand , Joanne Koong , miklos@szeredi.hu, linux-fsdevel@vger.kernel.org, jefflexu@linux.alibaba.com, josef@toxicpanda.com, linux-mm@kvack.org, kernel-team@meta.com, Matthew Wilcox , Oscar Salvador , Michal Hocko References: <20241122232359.429647-1-joannelkoong@gmail.com> <20241122232359.429647-5-joannelkoong@gmail.com> <0CF889CE-09ED-4398-88AC-920118D837A1@nvidia.com> <722A63E5-776E-4353-B3EE-DE202E4A4309@nvidia.com> From: Bernd Schubert Content-Language: en-US, de-DE, fr In-Reply-To: <722A63E5-776E-4353-B3EE-DE202E4A4309@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: BBC188000B X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: bq3ox4izhgwqe3tit71uou5wfrqktzng X-HE-Tag: 1734624484-34354 X-HE-Meta: U2FsdGVkX1/EYI9ok3d/xeZFcjETmv28V8cv9PsXPiD795GDKQHT/5P+hSY2fFx+dEtx03KSk5qiU6mV1NzAzTPzTEwdxIVYwPjuMpf2/AxTpUgnKGn/vmdLDrCHOXQjtuflbhnbcZ3GJgPVgcLWstbt5P7a3FbP/AdFIfoIDUIZVVSo6crX+QUHqEt6ySl3OlT0jON75IBRZduiFS+eUrVOfbuwXhfg+dMjadx6FDk0y+5pwnUHTIUpDtglEInilPfKwoU0ZLlgtZjAs6GUQQcjncmAvtELq08wDZ8wugVHq/0Bz2NK8Y2GaFwNpcO52mEaxsSHTNST3czSSx1MzNhZ5wIRR2MxSjGUPIC+fEDdwcUOAVc8ox/AXxHqfP7AwBczpYLtKdOObeq/l6iJYY0b6lvORGGqaDvZOD8wh8dtQWRD/YyAfFBDHJmbbyXLQxuFAzdS0XQpOb6buxPLIwrzMB7X0zAfiftNf8u/5pQMZWOFmMPW+h+PbRm7RtX56h9BXKXEym57kJxho6AziX+CDEWlbmiuPuaHFTXqzWCctKt1Lm6aKUwYAG4wEwItUYrfFGKkgbBPbRk3fPv36NANY+StqH+Rt3Q3eFRgDp8IMmT6BReYzl2UulwJSQg9FxepVt1b2TFKlCPTACH98nn20FO6QcqFyiMy6ii3ndj708ov/KO4HXOc3fC+ywdq8WTsns1AAYbgKmHrST5/fq/HJvPRSgt1R03/0op+k7Qj9aGams9G/qLa5f6ebiZYKwV4Fb9QMM3wLXJSZ5T3HtQeTQer9xEk16t2wbSa90lZHsoZDNGKAEF1Om+QK2Atqdot1YX0rFRqbGYTwWSlwd1jFUFJ6z7t8c8gdejo2wIVFH2DzxxieHo/LzxRUHRLOHG2FuH1Uav76if6LQ403cci086rseicUQmZH1oAsmNNE5HjmPAnuWguZBTFcoFC3VJLC8usv0BKK6AHriu cCl4/CHl xguYvLxo7q5AMyFzTXzLp+IbKVTbMtL0J8ZVNqk3LYQOs3XEJQdgi3uSlPFVwBiMVKxCvp20KLJBY0FvRJogDE+PCkcdiljtW5Xb0zQb6G9DSP/Njv0ukVoYS0s4X5KYsvAuVQkj3ZjDvueKdBcnE8MSWbeFOGVSZKrWnWvWlA6lMO4X4LMvD24moS+tC+QSWRsJtzeotWuYolLOqOiNLn8AGfNTPrKseM+IoxdOhiUgDhAyZPN5JnFn8SFJMISU0Y/usr8DZctlFmVwkjUMskFUy4An5qqwKqQ1j5qFh6+YoqXdA3wttJENti7PShPxhBHmOM+hwvW0yPlm7FArEvFe5IiWp4SihMl0orzphg48SpGbpdZzwqppgWRUk2Yz5CsBxqWItYHo9wAyi6uG0sFePWZrdr8bfudtbnas3Cap/NyyTFZkOyiWi5GZMdeLRLJBDnPB1S7ZLl4ko+r24mYYc0MVzkwOu/v9mKOqKMuCRmiGSlF9Nk0EHQw== 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 12/19/24 17:02, Zi Yan wrote: > On 19 Dec 2024, at 11:00, Zi Yan wrote: >> On 19 Dec 2024, at 10:56, Bernd Schubert wrote: >> >>> On 12/19/24 16:55, Zi Yan wrote: >>>> On 19 Dec 2024, at 10:53, Shakeel Butt wrote: >>>> >>>>> On Thu, Dec 19, 2024 at 04:47:18PM +0100, David Hildenbrand wrote: >>>>>> On 19.12.24 16:43, Shakeel Butt wrote: >>>>>>> On Thu, Dec 19, 2024 at 02:05:04PM +0100, David Hildenbrand wrote: >>>>>>>> On 23.11.24 00:23, Joanne Koong wrote: >>>>>>>>> For migrations called in MIGRATE_SYNC mode, skip migrating the folio if >>>>>>>>> it is under writeback and has the AS_WRITEBACK_INDETERMINATE flag set on its >>>>>>>>> mapping. If the AS_WRITEBACK_INDETERMINATE flag is set on the mapping, the >>>>>>>>> writeback may take an indeterminate amount of time to complete, and >>>>>>>>> waits may get stuck. >>>>>>>>> >>>>>>>>> Signed-off-by: Joanne Koong >>>>>>>>> Reviewed-by: Shakeel Butt >>>>>>>>> --- >>>>>>>>> mm/migrate.c | 5 ++++- >>>>>>>>> 1 file changed, 4 insertions(+), 1 deletion(-) >>>>>>>>> >>>>>>>>> diff --git a/mm/migrate.c b/mm/migrate.c >>>>>>>>> index df91248755e4..fe73284e5246 100644 >>>>>>>>> --- a/mm/migrate.c >>>>>>>>> +++ b/mm/migrate.c >>>>>>>>> @@ -1260,7 +1260,10 @@ static int migrate_folio_unmap(new_folio_t get_new_folio, >>>>>>>>> */ >>>>>>>>> switch (mode) { >>>>>>>>> case MIGRATE_SYNC: >>>>>>>>> - break; >>>>>>>>> + if (!src->mapping || >>>>>>>>> + !mapping_writeback_indeterminate(src->mapping)) >>>>>>>>> + break; >>>>>>>>> + fallthrough; >>>>>>>>> default: >>>>>>>>> rc = -EBUSY; >>>>>>>>> goto out; >>>>>>>> >>>>>>>> Ehm, doesn't this mean that any fuse user can essentially completely block >>>>>>>> CMA allocations, memory compaction, memory hotunplug, memory poisoning... ?! >>>>>>>> >>>>>>>> That sounds very bad. >>>>>>> >>>>>>> The page under writeback are already unmovable while they are under >>>>>>> writeback. This patch is only making potentially unrelated tasks to >>>>>>> synchronously wait on writeback completion for such pages which in worst >>>>>>> case can be indefinite. This actually is solving an isolation issue on a >>>>>>> multi-tenant machine. >>>>>>> >>>>>> Are you sure, because I read in the cover letter: >>>>>> >>>>>> "In the current FUSE writeback design (see commit 3be5a52b30aa ("fuse: >>>>>> support writable mmap"))), a temp page is allocated for every dirty >>>>>> page to be written back, the contents of the dirty page are copied over to >>>>>> the temp page, and the temp page gets handed to the server to write back. >>>>>> This is done so that writeback may be immediately cleared on the dirty >>>>>> page," >>>>>> >>>>>> Which to me means that they are immediately movable again? >>>>> >>>>> Oh sorry, my mistake, yes this will become an isolation issue with the >>>>> removal of the temp page in-between which this series is doing. I think >>>>> the tradeoff is between extra memory plus slow write performance versus >>>>> temporary unmovable memory. >>>> >>>> No, the tradeoff is slow FUSE performance vs whole system slowdown due to >>>> memory fragmentation. AS_WRITEBACK_INDETERMINATE indicates it is not >>>> temporary. >>> >>> Is there is a difference between FUSE TMP page being unmovable and >>> AS_WRITEBACK_INDETERMINATE folios/pages being unmovable? > > (Fix my response location) > > Both are unmovable, but you can control where FUSE TMP page > can come from to avoid spread across the entire memory space. For example, > allocate a contiguous region as a TMP page pool. Wouldn't it make sense to have that for fuse writeback pages as well? Fuse tries to limit dirty pages anyway. Thanks, Bernd