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 ACB23CE79AA for ; Tue, 19 Sep 2023 16:01:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19B5D6B007B; Tue, 19 Sep 2023 12:01:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14CE86B007D; Tue, 19 Sep 2023 12:01:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 013106B007E; Tue, 19 Sep 2023 12:01:00 -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 E57D56B007B for ; Tue, 19 Sep 2023 12:01:00 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A889180611 for ; Tue, 19 Sep 2023 16:01:00 +0000 (UTC) X-FDA: 81253810680.06.1CBD7F5 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by imf01.hostedemail.com (Postfix) with ESMTP id 3870140034 for ; Tue, 19 Sep 2023 16:00:57 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=hN21u1pB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of yosryahmed@google.com designates 209.85.208.50 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695139258; 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=a0R/NEqhp8mvFMCcaKYM+AhiLyAZfM1uN2ggUzMalzw=; b=uLKTDdDn8PkAkH1+wnDj1ffyaOjTyy5y78SmFU/e4N8XiIKth0hCCLNAQnZwDLRZ4yDQxI cRXpdUqM+qaZ/3Gshjcm1rxmzJoVV8DJB4tiGu2n+sPjMhZfJ9+AQz34cVzYfHEFrZh34l ou3nqIhaGoEzgeiAfgjey6oBbvXkrMY= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=hN21u1pB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of yosryahmed@google.com designates 209.85.208.50 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695139258; a=rsa-sha256; cv=none; b=5SCIyRAe+gy4I/f3NH7bRPB2Jf7XO1UXwc0xkZrVpJQlprtko0DZz5MDbmnVoP3HabDzT5 Tod/hdi8iJl8F24NHniCdpv6Re8Qoe09zxDY+A6MvKeNBc+N7ImWuSjxL5xZTbzbUVSRzx BY1zLzCVGvXy2Bey6r1YPN4jcrq6gYk= Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-51e28cac164so14833610a12.1 for ; Tue, 19 Sep 2023 09:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695139256; x=1695744056; 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=a0R/NEqhp8mvFMCcaKYM+AhiLyAZfM1uN2ggUzMalzw=; b=hN21u1pBsJqpB+nuGViuaxwt5sl15x4Cva1tk2lgP0VUIOUc5hsphJQTQV7UoW1x6z 6yTfiQRs/jEIrNNBNz9/k2pE/+JosmY8L9vtRKniZyfuEA5mJibHzsPtOFe6Pms9f4Qd 3/zt9tHzd4dCCYYy2YYH7hNntXg3RaNA9qHag2xMHyjkzzKqdtbcSmRe577arnzBvLrl DHbKeSgS1SHlfrlGTxHERgd1CK18CBigt8dDUL2F9ANbRuwWiPiMZ6jMdHOnJfN+bYMD 1TjdmKwbnbcYZkizzI3TsQ402SjfH22keB5hQdRBXGFgGB0QFEdov08t2b5ao02KTlgv jjkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695139256; x=1695744056; 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=a0R/NEqhp8mvFMCcaKYM+AhiLyAZfM1uN2ggUzMalzw=; b=fwfLrNTCZb1X0AanKWCqkdILWq6+cO3s/hbfDbWZIu9JzgjXmDyOl5kXnZej+s9aYA gp+1SyxwxDdBkg5akts9HdPBXr3LyypXf3wmPAMoU/9yFNqjrVA/rG10DzCaMY02DwnE dDKrLsRbeZMnuZ0wz6LqmualyOBYxkqS7b5uoCEZQsrXZ8FD3RD+qUVEeKn9+blxznhL IHriyGZ31YotO2FqooyLXSpBB9hYV6cL62Tz7sfa66OLyvuaYHBhqPnT0CmLm+cL5qTF 1JtFlX7erWEGKVtEYf3KF68PQ6IxFuH4qpWYLKgxL1fw753EeBE90K13Rr07G5Touh64 Di8A== X-Gm-Message-State: AOJu0YwZvKew4kS08ePH4I1O7wW6y5SY1ybdHjog7mgcCnvN3GJFvj1u dRWxsON9foVng1LCCyvRygAXkV2gVzStSJvAPwpclg== X-Google-Smtp-Source: AGHT+IGwZwS2c6qiWZ9zWVkmGdcNaP8g1k2FnfUTXQz40ZbXZpXm7Nn5A9VeM/7x9bLj2HVuo2cxxg+CmzsH7772dVQ= X-Received: by 2002:a17:906:51d2:b0:9a5:9305:83fb with SMTP id v18-20020a17090651d200b009a5930583fbmr128884ejk.34.1695139255976; Tue, 19 Sep 2023 09:00:55 -0700 (PDT) MIME-Version: 1.0 References: <20230915095042.1320180-1-da.gomez@samsung.com> <20230915095042.1320180-7-da.gomez@samsung.com> <20230918075758.vlufrhq22es2dhuu@sarkhan> <20230919132633.v2mvuaxp2w76zoed@sarkhan> In-Reply-To: <20230919132633.v2mvuaxp2w76zoed@sarkhan> From: Yosry Ahmed Date: Tue, 19 Sep 2023 09:00:16 -0700 Message-ID: Subject: Re: [PATCH 6/6] shmem: add large folios support to the write path To: Daniel Gomez Cc: "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "willy@infradead.org" , "hughd@google.com" , "akpm@linux-foundation.org" , "mcgrof@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "gost.dev@samsung.com" , Pankaj Raghav Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: nesudnb9nq54ai917kccjh75fi8qorqm X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3870140034 X-HE-Tag: 1695139257-901409 X-HE-Meta: U2FsdGVkX1+CSHJb87vrebiD/ZguNpiwmEzOH3/tMdmJdFhDmpKuwnXgStLmArQAwl0/2F4AthEJfegUPwNhX4ON5jssgJVNObQH9BfIyfE4HlysZY0I/QhYpOSlPihbp8Itlec9nRdMIh2dcLGKh2kxcbR44cYTufBEwVutI5rYINF1n2etyNTd8sbBwE5ru8GEPWYdLDVPEPmsaBxPEZEwBpR0d8gE+LNCBXChiTYq2Oh/yreXvR5HaRF+nk4u3ZuO3t8psRQat11QnvzUf1y9Su8cuft9rYJ+TAVYJAvxFTCeRFLt3/+U4Lz4AtEl5vIXBB3nuIjylj7VnQrElpchULtEK+ugZcyxZOIym0P4Pb9i+4G4S1oCP2R4A5AYx+P2QlqPitNr0XgoHPIvklrI7KVWq3ZBzq2+Qo32sAlLIiyyDdBMK/4DOPN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8tm9lGlB8fojHi/5YwK12FZ 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: On Tue, Sep 19, 2023 at 6:27=E2=80=AFAM Daniel Gomez = wrote: > > On Mon, Sep 18, 2023 at 11:55:34AM -0700, Yosry Ahmed wrote: > > On Mon, Sep 18, 2023 at 1:00=E2=80=AFAM Daniel Gomez wrote: > > > > > > On Fri, Sep 15, 2023 at 11:26:37AM -0700, Yosry Ahmed wrote: > > > > On Fri, Sep 15, 2023 at 2:51=E2=80=AFAM Daniel Gomez wrote: > > > > > > > > > > Add large folio support for shmem write path matching the same hi= gh > > > > > order preference mechanism used for iomap buffered IO path as use= d in > > > > > __filemap_get_folio(). > > > > > > > > > > Use the __folio_get_max_order to get a hint for the order of the = folio > > > > > based on file size which takes care of the mapping requirements. > > > > > > > > > > Swap does not support high order folios for now, so make it order= 0 in > > > > > case swap is enabled. > > > > > > > > I didn't take a close look at the series, but I am not sure I > > > > understand the rationale here. Reclaim will split high order shmem > > > > folios anyway, right? > > > > > > For context, this is part of the enablement of large block sizes (LBS= ) > > > effort [1][2][3], so the assumption here is that the kernel will > > > reclaim memory with the same (large) block sizes that were written to > > > the device. > > > > > > I'll add more context in the V2. > > > > > > [1] https://protect2.fireeye.com/v1/url?k=3Da80aab33-c981be05-a80b207= c-000babff9b5d-b656d8860b04562f&q=3D1&e=3D46666acf-d70d-4e8d-8d00-b027808ae= 400&u=3Dhttps%3A%2F%2Fkernelnewbies.org%2FKernelProjects%2Flarge-block-size > > > [2] https://protect2.fireeye.com/v1/url?k=3D3f753ca2-5efe2994-3f74b7e= d-000babff9b5d-e678f885471555e3&q=3D1&e=3D46666acf-d70d-4e8d-8d00-b027808ae= 400&u=3Dhttps%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2Fe%2F2PACX-1vS7sQ= fw90S00l2rfOKm83Jlg0px8KxMQE4HHp_DKRGbAGcAV-xu6LITHBEc4xzVh9wLH6WM2lR0cZS8%= 2Fpubhtml%23 > > > [3] https://lore.kernel.org/all/ZQfbHloBUpDh+zCg@dread.disaster.area/ > > > > > > > > It seems like we only enable high order folios if the "noswap" moun= t > > > > option is used, which is fairly recent. I doubt it is widely used. > > > > > > For now, I skipped the swap path as it currently lacks support for > > > high order folios. But I'm currently looking into it as part of the L= BS > > > effort (please check spreadsheet at [2] for that). > > > > Thanks for the context, but I am not sure I understand. > > > > IIUC we are skipping allocating large folios in shmem if swap is > > enabled in this patch. Swap does not support swapping out large folios > > as a whole (except THPs), but page reclaim will split those large > > folios and swap them out as order-0 pages anyway. So I am not sure I > > understand why we need to skip allocating large folios if swap is > > enabled. > > I lifted noswap condition and retested it again on top of 230918 and > there is some regression. So, based on the results I guess the initial > requirement may be the way to go. But what do you think? > > Here the logs: > * shmem-large-folios-swap: https://gitlab.com/-/snippets/3600360 > * shmem-baseline-swap : https://gitlab.com/-/snippets/3600362 > > -Failures: generic/080 generic/126 generic/193 generic/633 generic/689 > -Failed 5 of 730 tests > \ No newline at end of file > +Failures: generic/080 generic/103 generic/126 generic/193 generic/285 ge= neric/436 generic/619 generic/633 generic/689 > +Failed 9 of 730 tests > \ No newline at end of file > > I am not really familiar with these tests so I cannot really tell what's going on. I can see "swapfiles are not supported" in the logs though, so it seems like we are seeing extra failures by just lifting "noswap" even without actually swapping. I am curious if this is just hiding a different issue, I would at least try to understand what's happening. Anyway, I don't have enough context here to be useful. I was just making an observation about reclaim splitting shmem folios to swap them out as order-0 pages, and asking why this is needed based on that. I will leave it up to you and the reviewers to decide if there's anything interesting here.