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 7CB5EE77188 for ; Fri, 20 Dec 2024 21:02:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A6AE26B007B; Fri, 20 Dec 2024 16:02:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A1AA06B0082; Fri, 20 Dec 2024 16:02:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8BB686B0083; Fri, 20 Dec 2024 16:02:00 -0500 (EST) 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 6D96E6B007B for ; Fri, 20 Dec 2024 16:02:00 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C969B80DB9 for ; Fri, 20 Dec 2024 21:01:59 +0000 (UTC) X-FDA: 82916559264.29.CF58A9C Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by imf03.hostedemail.com (Postfix) with ESMTP id 46ADF20029 for ; Fri, 20 Dec 2024 21:01:42 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=THdQiZkC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.160.173 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734728485; a=rsa-sha256; cv=none; b=OkHfXwK1A4+ZTzDb2dQ9lyz5AO6SPiB3drPsA8VzVpdpiIMw1k/IVGStTs+yEIZPKzNtNF 4pI9w1nERaw1F5fhb2nKZCszyX4lKDWvVs6E+zLP+t1ZkXxNrAVAg9SqhKTHlTq0uL5IUd 0Uu3X8pgciMEKOTw+z+kmiNgTMZcUDE= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=THdQiZkC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.160.173 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734728485; 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=Ytr1v1Bw7arE5zymE2nO4szf5NYsr7gMv345sU8XBbM=; b=zHAyjQcxV7C5LhSXHamtewMlCAUKCPv/5gYiXoxY6CQEvfkhPYJAiolEJPj/SXW1IA0UeB u1rdp3yxUSG9G6m6W9P5ye++EVciY9qhVsu/RIiD86GbJbwMW6SlivCCWKc+wxnRY60567 24eOEAlpxpANudTUAL0wHRxmsjVGWzo= Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-46741855f9bso20353781cf.2 for ; Fri, 20 Dec 2024 13:01:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734728517; x=1735333317; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ytr1v1Bw7arE5zymE2nO4szf5NYsr7gMv345sU8XBbM=; b=THdQiZkCGBWcVs1T1McJDLy63J78OSzd6LI7aSRg6+aP0RiJMj580MYRei7yIxBo2M dsyW69P9jMH5T6E4LHl4Yg/6S2P2r11ux++eMxBfdqMIv+Qe4W3hqj6CuOqme7n0FeiK ujsQYnv898FxwwrVQSeZtdZJ7hBV/CtbfRZfD50osdog2M20InK4m77wTP4O+Dz4GD/w z6KFqbEV5MDGWeBXWHiyX8wxU0yU5s15Hshyi3m9AQJQiSW1mCW+DDiJlzAyXNK0tlrA 01OGfj4tpTqInhxfFow4dSURN5owNJ/qbzu4lTKcw+3eot9g3AN2i8BMFGXvRmwCvOcw 6FQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734728517; x=1735333317; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ytr1v1Bw7arE5zymE2nO4szf5NYsr7gMv345sU8XBbM=; b=N9P7QdvQBB/koCyEbshMfqcVHna5t7HrWX+3x/8PBjQHLMUktVb3W4oFhromzw4s2R G4qBPLq6eGQZNJTxjdnoGbqRFIpCZaXPrld5w8tLhVpiXjaO9sYOpPWfV/DK7rk4h+y1 Cott3PnpyVmRRo4nXfCjPRVx0OBrP+HKRwzZPRzOh3904QRB3R030CVtjgdEhtk7p6RJ g0ighIcglizD+wPDnLK+KLMEJIA73GpQu5Ja9rRTj3jxX01CBgq/YiTGxPk7CTW3JYGV cX9pIZ9V0I5weaRtTl9aznnhs/ctkrvK2Zc5JYttdd1HhkLRobAvRUuS0OTZEH6w1vcP D3pw== X-Forwarded-Encrypted: i=1; AJvYcCXie2E3dqYv2ezmyoSrs4zbe+D/gt5zwx6jiHpG6ChB8qszwi7ZZK3TEsks1G0MUA0HKzFierYCcQ==@kvack.org X-Gm-Message-State: AOJu0YyMm7NN92BVNKtzOjp715rkKAj2cHGdOgUeW78nPkcxma+CiXc/ gvN83fgy2nPo38UDT+ywZwpGtvdhzVWgg8hqrbL8PWdQATWOaDArzmVz4XVwK+o9tr2JjgfbbCj PVxvzhZDj6KV2pU1MUtudYdwwgOI= X-Gm-Gg: ASbGnctnLeJBEQNgfe1Qh69AwYpjX6YJKK7BtZuIpfsiOpkGn+WCshc2cwQrp34kwKC aaMiQtW2x7hwtCm9ydFA8ln54GfoiU+nIBbEP8Yo= X-Google-Smtp-Source: AGHT+IFTGFkhw3g3zTscn7M0FHo1K9ZsZAMHNzDMdz7Nd2l4rxPJQJcx5/GQ32u4yMAggjh+Sibjlwq8D5DzUNuzS6k= X-Received: by 2002:a05:622a:1a07:b0:466:99a9:c354 with SMTP id d75a77b69052e-46a4a8cc49cmr77255841cf.22.1734728516983; Fri, 20 Dec 2024 13:01:56 -0800 (PST) MIME-Version: 1.0 References: <43e13556-18a4-4250-b4fe-7ab736ceba7d@redhat.com> <968d3543-d8ac-4b5a-af8e-e6921311d5cf@redhat.com> <7b6b8143-d7a4-439f-ae35-a91055f9d62a@redhat.com> <2e13a67a-0bad-4795-9ac8-ee800b704cb6@fastmail.fm> <2bph7jx4hvhxpgp77shq2j7mo4xssobhqndw5v7hdvbn43jo2w@scqly5zby7bm> <71d7ac34-a5e5-4e59-802b-33d8a4256040@redhat.com> <9404aaa2-4fc2-4b8b-8f95-5604c54c162a@redhat.com> In-Reply-To: <9404aaa2-4fc2-4b8b-8f95-5604c54c162a@redhat.com> From: Joanne Koong Date: Fri, 20 Dec 2024 13:01:46 -0800 Message-ID: Subject: Re: [PATCH v6 4/5] mm/migrate: skip migrating folios under writeback with AS_WRITEBACK_INDETERMINATE mappings To: David Hildenbrand Cc: Bernd Schubert , Shakeel Butt , Zi Yan , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 46ADF20029 X-Stat-Signature: nmseon1dgs4g54thq8cm5n4cer78rfwk X-Rspam-User: X-HE-Tag: 1734728502-11821 X-HE-Meta: U2FsdGVkX1/G31ZcU1f5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TT8dXvcQIDFRshOEiqwhcs1HUplWKa4gKVr1ZlPTCwpEKqgXrGjOE37FG+UrIFuv1Jr06tU6peWpZE84IkUBoOGvCuDVORBLa3OL5oyszFrxhL59dUK6385XoDQF0N11BtEQn9DAtJWeKZ4/SL0N6FlN9hagyIdVyTpkNCBIaVx72YG3twmX+geAqGShjhMLQhnavsZhRpr3dLpkTUyiplT2Dx8Op9H9cfP9P4nK/qntUd4saHUGhuGaHscQiTuuP/77CdVBsWj1iTmVWdlRYhuWRCSsU3Ek= X-Bogosity: Ham, tests=bogofilter, spamicity=0.201902, 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 Fri, Dec 20, 2024 at 6:49=E2=80=AFAM David Hildenbrand wrote: > > >> I'm wondering if there would be a way to just "cancel" the writeback a= nd > >> mark the folio dirty again. That way it could be migrated, but not > >> reclaimed. At least we could avoid the whole AS_WRITEBACK_INDETERMINAT= E > >> thing. > >> > > > > That is what I basically meant with short timeouts. Obviously it is not > > that simple to cancel the request and to retry - it would add in quite > > some complexity, if all the issues that arise can be solved at all. > > At least it would keep that out of core-mm. > > AS_WRITEBACK_INDETERMINATE really has weird smell to it ... we should > try to improve such scenarios, not acknowledge and integrate them, then > work around using timeouts that must be manually configured, and ca > likely no be default enabled because it could hurt reasonable use cases := ( > > Right now we clear the writeback flag immediately, indicating that data > was written back, when in fact it was not written back at all. I suspect > fsync() currently handles that manually already, to wait for any of the > allocated pages to actually get written back by user space, so we have > control over when something was *actually* written back. > > > Similar to your proposal, I wonder if there could be a way to request > fuse to "abort" a writeback request (instead of using fixed timeouts per > request). Meaning, when we stumble over a folio that is under writeback > on some paths, we would tell fuse to "end writeback now", or "end > writeback now if it takes longer than X". Essentially hidden inside > folio_wait_writeback(). > > When aborting a request, as I said, we would essentially "end writeback" > and mark the folio as dirty again. The interesting thing is likely how > to handle user space that wants to process this request right now (stuck > in fuse_send_writepage() I assume?), correct? This would be fine if the writeback request hasn't been sent yet to userspace but if it has and the pages are spliced, then ending writeback could lead to memory crashes if the pipebuf buf->page is accessed as it's being migrated. When a page/folio is being migrated, is there some state set on the page to indicate that it's currently under migration? The only workaround I can see for the splice case that doesn't resort to bringing back extra copies is to have splice somehow ensure that the page isn't being migrated when it's accessing it. Thanks, Joanne > > Just throwing it out there ... no expert at all on fuse ... > > -- > Cheers, > > David / dhildenb >