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 92B06D149D9 for ; Fri, 25 Oct 2024 17:36:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A0C26B0089; Fri, 25 Oct 2024 13:36:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 250136B008A; Fri, 25 Oct 2024 13:36:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13F8B6B008C; Fri, 25 Oct 2024 13:36:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EAA466B0089 for ; Fri, 25 Oct 2024 13:36:40 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EDF0C40D69 for ; Fri, 25 Oct 2024 17:36:29 +0000 (UTC) X-FDA: 82712829150.28.896E808 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by imf06.hostedemail.com (Postfix) with ESMTP id 98B5918001B for ; Fri, 25 Oct 2024 17:36:24 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="YRh/Qkg3"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.160.171 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729877758; a=rsa-sha256; cv=none; b=lo6c2GBTrOr2hTaVJHNkt5Av43GQUxP72rLOKpUAvrLoD5E8sUh/BpKmBc09fwGqrvB5Pa HvIlQWW7nm1VL2qxiFLy/kM+OB2EEIOrz24UOibRyqBt/SRoP4NEgOvnR+VN7G0g3pAyXu BBRQmglLXlMTBmNfkaYSQ7YfoDHFfew= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="YRh/Qkg3"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.160.171 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=1729877758; 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=0az00lxDNAIqegju9SoC5ZxH1jcOnDSrVBFR0VhF8yY=; b=V/VSoDzbhM5J/FDtFkvDg+zP2JejOG1V0zA3IUzYmLLLgQBKFuTQmwnrdFjmv6FYP5/oB6 Z7MqN62ONzg68W1Q6VN9XPiuFoz60YNu0rciUCEambNUuFq3dquLRzGe/k0ixVXnqQ6Pma zy5yabglK2rQ+eGVIWV3pz5JVAW9h4E= Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-460b16d4534so11594201cf.3 for ; Fri, 25 Oct 2024 10:36:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729877798; x=1730482598; 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=0az00lxDNAIqegju9SoC5ZxH1jcOnDSrVBFR0VhF8yY=; b=YRh/Qkg3Q1aGJdoL+vWcIlOWlI7KW7jlrgM6IxIjsFcRCkEZ8lMYXm+PxlkFv9lekJ sz1hcna6rWJz2ymocbXZhSJTRg/38SddEQ4/q5OEPxbGg4aosciTHwDopBBSxhAVHonw 2J0r4eqyCSahY5rg8GmvUs3eNiWFuOnv7ZVUAJb2rYQ2tKneu2j9oKhF6bTbT98RKRO4 /glqgnVSUHhE27n1P2LcBYNnybV9o4ZOY52Uj4sX7FJbXjMBFSjYRmmLSYmIXUfLeOs+ ikURL+YDeGGU0KgZVj/u1wdn8a+Ck0/FaYGI/CG9ilFZZewv98k0VhTog+yx8fqAqlJv trEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729877798; x=1730482598; 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=0az00lxDNAIqegju9SoC5ZxH1jcOnDSrVBFR0VhF8yY=; b=xQI1RUb/qVOvogLeUmr4uoIUFDHOO1SPRTWFmNiSSHYm/iL/hwmGcoTwPzsYg6gYOm 69wkv9qQr5qqp6i5bMXQlYAEjFm2nJGJ2p7W6Da1/8CDNHH8pw07ZcC3Sdlj0OUf5fd3 jIXYH9GS85zvH1JmAqVe67Ny07KttmK0W9evuagglGhL4ZcVxj5uSp7amtNwEzAEw08d ZeGfSWSQ5L5Xk0jYSubiKM364D96KxaDMGOjdsx32fDkrTyHj56DJygDLZjjxOzQOu/d 6yR/in/OAtj6l3PbyBpRDpvP4fXNDvGe9Z/d3gOqK6UTpJ5ZlO2FJjJCnCs8HJkNb/UL OqFQ== X-Forwarded-Encrypted: i=1; AJvYcCVOQHZ30CTBKc5jpHAuCYjHiGkZiOJWFV5f5/qcwl0mOIOMErwO9vvF60Fi6hyuf8ImTjq9UGE+fA==@kvack.org X-Gm-Message-State: AOJu0YyC4zKM0WoVCY+mdr4TuZD1qzIe9E0ylU4NiEseqm86lFHrWQHi pwhHwuzGL2msRyBqmIsGXiYz1lMCCemhu7N6Z1XebxeTiCNedgLLjD5Rr0Pr7K2do1c+M7vA5t1 MJlukhlrBpzLFxpdrkxgHRQfmQU8= X-Google-Smtp-Source: AGHT+IGgUJTGTvWVjwfxjsQTiCen6/FgeIoYvhFOGlz59d6rzI1orPrnmd07K1Y0ysC62zVCBCgAPY/JQNLDfRf4TWE= X-Received: by 2002:a05:622a:19a6:b0:45f:898:5c65 with SMTP id d75a77b69052e-4613c0541c1mr541531cf.31.1729877797713; Fri, 25 Oct 2024 10:36:37 -0700 (PDT) MIME-Version: 1.0 References: <20241014182228.1941246-1-joannelkoong@gmail.com> <20241014182228.1941246-3-joannelkoong@gmail.com> <3e4ff496-f2ed-42ef-9f1a-405f32aa1c8c@linux.alibaba.com> In-Reply-To: <3e4ff496-f2ed-42ef-9f1a-405f32aa1c8c@linux.alibaba.com> From: Joanne Koong Date: Fri, 25 Oct 2024 10:36:26 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] fuse: remove tmp folio for writebacks and internal rb tree To: Jingbo Xu Cc: Miklos Szeredi , Shakeel Butt , linux-fsdevel@vger.kernel.org, josef@toxicpanda.com, bernd.schubert@fastmail.fm, hannes@cmpxchg.org, linux-mm@kvack.org, kernel-team@meta.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: wx5xhenjxetwftwctyqertj6mpqtkdo8 X-Rspamd-Queue-Id: 98B5918001B X-Rspamd-Server: rspam02 X-HE-Tag: 1729877784-727034 X-HE-Meta: U2FsdGVkX186kRACor8veFuuO48So0yGxQ5CuanUfXs1SAfKGXtzsCU8a86UfYXRObEhcRcJDOARQZtEgrPD0x0pbuVnZmX4HCRp+HIZk9Vbrv8H8XSpXwawuY6aP4JBANu/pW+1S3enRckhc96dGjb7REk+sEm2y3+oex5BQ14K6WSVbq2e3No3dLYqTRJNTLpqtEih4/4SyfVqVnpr6tOGufHDL4yxCS6IS/10uT4M3QGepPNeGwKPi39Rz3XLKCbQaJzw9i9muawiYDR0h8SOpF5bbcdCwi3OMKL6cXLQCoPHcglosSqmIVqd3t8iMNpzeMkjJV7gIR3lY3F+DenclTI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ests=bogofilter, spamicity=0.000001, 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, Oct 24, 2024 at 6:38=E2=80=AFPM Jingbo Xu wrote: > > > > On 10/25/24 12:54 AM, Joanne Koong wrote: > > On Mon, Oct 21, 2024 at 2:05=E2=80=AFPM Joanne Koong wrote: > >> > >> On Mon, Oct 21, 2024 at 3:15=E2=80=AFAM Miklos Szeredi wrote: > >>> > >>> On Fri, 18 Oct 2024 at 07:31, Shakeel Butt w= rote: > >>> > >>>> I feel like this is too much restrictive and I am still not sure why > >>>> blocking on fuse folios served by non-privileges fuse server is wors= e > >>>> than blocking on folios served from the network. > >>> > >>> Might be. But historically fuse had this behavior and I'd be very > >>> reluctant to change that unconditionally. > >>> > >>> With a systemwide maximal timeout for fuse requests it might make > >>> sense to allow sync(2), etc. to wait for fuse writeback. > >>> > >>> Without a timeout allowing fuse servers to block sync(2) indefinitely > >>> seems rather risky. > >> > >> Could we skip waiting on writeback in sync(2) if it's a fuse folio? > >> That seems in line with the sync(2) documentation Jingbo referenced > >> earlier where it states "The writing, although scheduled, is not > >> necessarily complete upon return from sync()." > >> https://pubs.opengroup.org/onlinepubs/9699919799/functions/sync.html > >> > > > > So I think the answer to this is "no" for Linux. What the Linux man > > page for sync(2) says: > > > > "According to the standard specification (e.g., POSIX.1-2001), sync() > > schedules the writes, but may return before the actual writing is > > done. However Linux waits for I/O completions, and thus sync() or > > syncfs() provide the same guarantees as fsync() called on every file > > in the system or filesystem respectively." [1] > > Actually as for FUSE, IIUC the writeback is not guaranteed to be > completed when sync(2) returns since the temp page mechanism. When > sync(2) returns, PG_writeback is indeed cleared for all original pages > (in the address_space), while the real writeback work (initiated from > temp page) may be still in progress. > That's a great point. It seems like we can just skip waiting on writeback to finish for fuse folios in sync(2) altogether then. I'll look into what's the best way to do this. > I think this is also what Miklos means in: > https://lore.kernel.org/all/CAJfpegsJKD4YT5R5qfXXE=3DhyqKvhpTRbD4m1wsYNbG= B6k4rC2A@mail.gmail.com/ > > Though we need special handling for AS_NO_WRITEBACK_RECLAIM marked pages > in sync(2) codepath similar to what we have done for the direct reclaim > in patch 1. > > > > > > Regardless of the compaction / page migration issue then, this > > blocking sync(2) is a dealbreaker. > > I really should have figureg out the compaction / page migration > mechanism and the potential impact to FUSE when we dropping the temp > page. Just too busy to take some time on this though..... Same here, I need to look some more into the compaction / page migration paths. I'm planning to do this early next week and will report back with what I find. Thanks, Joanne > > > -- > Thanks, > Jingbo