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 B6ACEE7718A for ; Thu, 19 Dec 2024 18:01:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 403896B007B; Thu, 19 Dec 2024 13:01:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B25B6B0082; Thu, 19 Dec 2024 13:01:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27BD66B0083; Thu, 19 Dec 2024 13:01:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0D70B6B007B for ; Thu, 19 Dec 2024 13:01:56 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id ADCE51C55DB for ; Thu, 19 Dec 2024 18:01:55 +0000 (UTC) X-FDA: 82912476696.29.C3674E2 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by imf28.hostedemail.com (Postfix) with ESMTP id 22A5FC001C for ; Thu, 19 Dec 2024 18:01:16 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=j+SZElWv; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.222.178 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734631282; a=rsa-sha256; cv=none; b=4d8b7hki9U/jlxYPz08aBtH1v9temk9ge/io40ndBX8gBR7m4UrPllSuN7fv1i5TpUEeaI JasF0ICqkoal50EAdUteMYCh0PIUuwWCkovlB1T3yvfgy74NFV5jSDduQyDWtXBWGLl6JT gHEn8jJM5Vmb7dvSEQtocVWKuKMxcGY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=j+SZElWv; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.222.178 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=1734631282; 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=0juxr8sPMj3buGysieiWx/mGUENjVf1ZhZQjwxnLKQI=; b=1tkqnED+Pe50eX99HcwONUjhhFZKaEM87hq/h844w4DhrugXUeV0sd5VNhFpbVaiKza10g DOgpewJgdTAz0FWZ6b1Qjp3imUhirrILWCR5Ck4/nBbvGPCCxS7K+K16U6IGfaGhkWgOVD xbhzCy9u1NXqyPsAKhjT7FJA3cfR76E= Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7b6e4d38185so75838985a.0 for ; Thu, 19 Dec 2024 10:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734631313; x=1735236113; 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=0juxr8sPMj3buGysieiWx/mGUENjVf1ZhZQjwxnLKQI=; b=j+SZElWv5mcN0HNz5VszNzTitV+ais/06Cn8t4iAFUVjENg/FF2eHObvvyQX1Gv3py sZgbhVqk+AtbsdOMU2WIHe6YXVWgUisl2Hkm7dTPr0eMWZg9uOoGuAYNy7Wf+ebNgvKK xAF5NMRZpBT638Pepg6y2ONSjSdWst3pMtcAFAfDSnAbMr996vGFjzbKpCflH5ksxUYw zZjyKwopfKVcOX7IbGJxOJp1i/nmPoWAuEHF2AWfEcsxzj1zIvD376U4apUA6qKFbhzr U9Pb6axpXUKYVUfOTSZlw0xSZAhjg+3h8krclX9px7bEbWM2EDalPpVOWm5YjRUxbYfj ps9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734631313; x=1735236113; 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=0juxr8sPMj3buGysieiWx/mGUENjVf1ZhZQjwxnLKQI=; b=C+pKTRyJDemZH/pHlHpHeWP+P9QUtIFY7WJfqIKOPvda0bQPCJJmT9HKKk/1Q4hzN9 RVpuAdyVdjeqwmtBEAgJzlUz2WoS+Gfl2YEVHPJcifhjCrj2hDTKYK5wgDoVcXuXU6lR 8fQbQG3DeD7oQPMPy2GAcc2V4n+5xixAWScwD3wPkriBn3O6zPb3QVJdivGXT3onVJuv oh76NTit8Oy/bJR65l8TPACDyHJIQu4VdtcSWmaRkPFJ3o5I6wV6ZcfTIMMistKICRUG NeAqsDUaElEL3LTadNfZOdPW4ioeGEhO+RjFMDb6plddrYtUeYKfMG1zBMJ2RLI4J1yb bxFA== X-Forwarded-Encrypted: i=1; AJvYcCWa8u42CMthCOy8xvUED+OOT/9fK/7yl7r6rNtBBWSz/zvKzsR1nER2oTBVtsB9zLJS7COCqX9TFw==@kvack.org X-Gm-Message-State: AOJu0Ywm6zoGU2Gu9pCleifRhEigi6ZiV6w2P9kKhUcZAe7bggVrRUk1 NiPPtGEKILlekwad6+HMcbY0FwW4p2CHw++02W5PL8Ung3xqwzXXXNqmP+rpG0qB+xHKr2+/Rqq t1t7pLt+fLQweC6ejOJ3y8vL7Tnekj4gk X-Gm-Gg: ASbGncvxqed0eiw4p3VFqoQSE74jO49AitTb5jWOdV14+qA+XEPozYA1FQNy9swRv+4 vHiF0I5ynbuqIP/3C2noNi6FAgzAMolI98fqlz/w= X-Google-Smtp-Source: AGHT+IGMJ2+v5ppenam+58Ugzq77XfY8FxUHxRt3N+1ClJ4itcPxzdr15LkdpBA++m3fEQCmHiTIrC1UIqJILT5ING4= X-Received: by 2002:a05:622a:2291:b0:46a:3579:d137 with SMTP id d75a77b69052e-46a3579d38bmr91618781cf.43.1734630930608; Thu, 19 Dec 2024 09:55:30 -0800 (PST) MIME-Version: 1.0 References: <20241122232359.429647-5-joannelkoong@gmail.com> <43e13556-18a4-4250-b4fe-7ab736ceba7d@redhat.com> <968d3543-d8ac-4b5a-af8e-e6921311d5cf@redhat.com> <7b6b8143-d7a4-439f-ae35-a91055f9d62a@redhat.com> In-Reply-To: <7b6b8143-d7a4-439f-ae35-a91055f9d62a@redhat.com> From: Joanne Koong Date: Thu, 19 Dec 2024 09:55:19 -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: Shakeel Butt , Zi Yan , miklos@szeredi.hu, linux-fsdevel@vger.kernel.org, jefflexu@linux.alibaba.com, josef@toxicpanda.com, bernd.schubert@fastmail.fm, 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-Stat-Signature: hmeqrsjd4zss13fscfy6auxjrzfiadzi X-Rspam-User: X-Rspamd-Queue-Id: 22A5FC001C X-Rspamd-Server: rspam08 X-HE-Tag: 1734631276-143653 X-HE-Meta: U2FsdGVkX1+1D0vvJfUgih3p5S3C+EPdBpOKR1mNBAjPukig/3VB7urAKnJy01O8nPoIQbE1Izyiw4Z/a6Om5RE8N6auBm3bmUSkDwETYCHm7rPK9oLnxnmTi52uykU38LVNpvVk2laECFeFuDunP3w23MJwG6gM04emyKfjQKPUgiOLr708LaDnti8JppAq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MwrCrAGm8Yh1aAvts0Hw232tnWbsftjA0f0X3rpVTmKujiH05bwqcbd1eronKlu0HmC/rv9lWj9jvrA1tyk1Y+F1/4M/okgr4KuPrCoETLm6u3DBGXyXsTECq8Biugrn98yEqingaI0NDY381/6Ng== X-Bogosity: Ham, tests=bogofilter, spamicity=0.322325, 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 Thu, Dec 19, 2024 at 9:26=E2=80=AFAM David Hildenbrand wrote: > > On 19.12.24 18:14, Shakeel Butt wrote: > > On Thu, Dec 19, 2024 at 05:41:36PM +0100, David Hildenbrand wrote: > >> On 19.12.24 17:40, Shakeel Butt wrote: > >>> On Thu, Dec 19, 2024 at 05:29:08PM +0100, David Hildenbrand wrote: > >>> [...] > >>>>> > >>>>> If you check the code just above this patch, this > >>>>> mapping_writeback_indeterminate() check only happen for pages under > >>>>> writeback which is a temp state. Anyways, fuse folios should not be > >>>>> unmovable for their lifetime but only while under writeback which i= s > >>>>> same for all fs. > >>>> > >>>> But there, writeback is expected to be a temporary thing, not possib= ly: > >>>> "AS_WRITEBACK_INDETERMINATE", that is a BIG difference. > >>>> > >>>> I'll have to NACK anything that violates ZONE_MOVABLE / ALLOC_CMA > >>>> guarantees, and unfortunately, it sounds like this is the case here,= unless > >>>> I am missing something important. > >>>> > >>> > >>> It might just be the name "AS_WRITEBACK_INDETERMINATE" is causing > >>> the confusion. The writeback state is not indefinite. A proper fuse f= s, > >>> like anyother fs, should handle writeback pages appropriately. These > >>> additional checks and skips are for (I think) untrusted fuse servers. > >> > >> Can unprivileged user space provoke this case? > > > > Let's ask Joanne and other fuse folks about the above question. > > > > Let's say unprivileged user space can start a untrusted fuse server, > > mount fuse, allocate and dirty a lot of fuse folios (within its dirty > > and memcg limits) and trigger the writeback. To cause pain (through > > fragmentation), it is not clearing the writeback state. Is this the > > scenario you are envisioning? > This scenario can already happen with temp pages. An untrusted malicious fuse server may allocate and dirty a lot of fuse folios within its dirty/memcg limits and never clear writeback on any of them and tie up system resources. This certainly isn't the common case, but it is a possibility. However, request timeouts can be set by the system admin [1] to protect against malicious/buggy fuse servers that try to do this. If the request isn't replied to by a certain amount of time, then the connection will be aborted and writeback state and other resources will be cleared/freed. Thanks, Joanne [1] https://lore.kernel.org/linux-fsdevel/20241218222630.99920-1-joannelkoo= ng@gmail.com/T/#t > Yes, for example causing harm on a shared host (containers, ...). > > If it cannot happen, we should make it very clear in documentation and > patch descriptions that it can only cause harm with privileged user > space, and that this harm can make things like CMA allocations, memory > onplug, ... fail, which is rather bad and against concepts like > ZONE_MOVABLE/MIGRATE_CMA. > > Although I wonder what would happen if the privileged user space daemon > crashes (e.g., OOM killer?) and simply no longer replies to any messages= . > > -- > Cheers, > > David / dhildenb >