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 BE51ACE79A8 for ; Tue, 19 Sep 2023 21:52:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BFC46B00DF; Tue, 19 Sep 2023 17:52:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16FCB6B00E0; Tue, 19 Sep 2023 17:52:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0372C6B00E1; Tue, 19 Sep 2023 17:52:20 -0400 (EDT) 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 E6DEF6B00DF for ; Tue, 19 Sep 2023 17:52:20 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B6B4E140E0C for ; Tue, 19 Sep 2023 21:52:20 +0000 (UTC) X-FDA: 81254696040.17.674D6AC Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by imf27.hostedemail.com (Postfix) with ESMTP id DC96D40021 for ; Tue, 19 Sep 2023 21:52:18 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QbCeHVAD; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf27.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.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=1695160339; 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=eliXjlnUj0/AODOfq0lfgn0v2M8TIN1LeS+hCeHav/U=; b=tuKMi6uzPwH02x2mFoLAXE71wH6BtUw3x3GKapRZMFn9JYg1leyCup2lU1jfcY5wdpnDB9 WUH9erETTx3cOluuPpamKpkcvgypgzRfa9yv0f3UqcuEqoC8yv2iFsqqhwUSKm9Qkh6s8l 09bzx0/oJS/z80V1Iejg6/N7zMZzo8g= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QbCeHVAD; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf27.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.50 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695160339; a=rsa-sha256; cv=none; b=teHygMPiTinl3IBrlNZbWJLqvBRG+m4BpCIbFSpquFfdBfwu2A2W7fj3qQK5T52c0xQAos PY6nwgcuIFkA1es6bKYT/NZbZX4a0GX/s6goftduhWLyqO54Xk63syWW6wBFx8FtxlpYnT 0mAx8DGj5vCmZlgJr4UIb5KB0mF63SM= Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-9936b3d0286so819930766b.0 for ; Tue, 19 Sep 2023 14:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695160337; x=1695765137; 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=eliXjlnUj0/AODOfq0lfgn0v2M8TIN1LeS+hCeHav/U=; b=QbCeHVADZmUFcAtL36ePkHWPJm6TMqnWseXVcnya6PkqAacUCukc4TuolbNTdCkfSM f+12Ahlhz8qqozAXJoFKEmrJsPbC9UOQ5WtKF2ZXMlmNAyaxqG2MYD/bgEj0/h9d0XNC lUviDLNJrwYpU54h7dB/WTUONsZvaK5UxHcwF4T3CbeSTJQQ9sPw9ec2ugopxih2Txfj dsl+1Yzwm9H5NDOeY85SIHytN2GcHszPu5gMoDk/0cuOVjN7/ZyWLhBeeZoas+H6W+18 49B/Lek0MR0Ky2Dd/U9Pee0+E3DxAkBXKzd7zD3oxImHa9nQK4nEF9CMWI1fRjBMd4ay jijQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695160337; x=1695765137; 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=eliXjlnUj0/AODOfq0lfgn0v2M8TIN1LeS+hCeHav/U=; b=OdXxvprzlNtDCAEz0sx8ZNpTqb1g/eeMc1VuWLKzo4pSe+PfMNADmfoYJrrW5WkEH8 fK/t9YkzwngXNi3BgHutLlxSJUwWgUOaFMFtY+jFh6zQQ+qZT8cVP/Z6Nu47HM3+uNOK 5jZCO5CZ62HTY4MOqDvS+SQluK1kGpWeLzG5yFIKIB0Sa+TUkB6r9nicFuxFu2BHWuB/ wGsIHZHZUEG48g6HPoFNIXUgj9Nl2dflcvudA6H3OutHpjA1nErHadMcEzrXMn2BAHGF 5B0PdY63FuoSaI+gemTUiMfZLOeQxc8+KY989cjaTQZLoAqkyO/j3xF7iXcJpHfVTE2l wi7g== X-Gm-Message-State: AOJu0Yyw+iZ6J/DNuwyuhFU6lxmVcGMuSHln2zdwlERT2tXvQ2JS5Lbo xUxgHaXtOi5fiT8goeMsTD6SFJ1y/wCcTboy6IAQqw== X-Google-Smtp-Source: AGHT+IEOBCWtLBMbM1AT0iqkM9hwo/7Pa2mMpNubzxGfRPNpEhB/75Pmmss4LVXbiittngA9ae8ICig1bNEo/UbeVZM= X-Received: by 2002:a17:906:18b1:b0:9a1:f3a6:b906 with SMTP id c17-20020a17090618b100b009a1f3a6b906mr437320ejf.36.1695160337022; Tue, 19 Sep 2023 14:52:17 -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: From: Yosry Ahmed Date: Tue, 19 Sep 2023 14:51:40 -0700 Message-ID: Subject: Re: [PATCH 6/6] shmem: add large folios support to the write path To: Luis Chamberlain Cc: Daniel Gomez , "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "willy@infradead.org" , "hughd@google.com" , "akpm@linux-foundation.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-Rspamd-Queue-Id: DC96D40021 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: xrbdbdhsmeqy33criry5jce6ysafauqf X-HE-Tag: 1695160338-809745 X-HE-Meta: U2FsdGVkX1/TixnXuNaoadJNBGFaN+X2r3bFhevqJKgcVKr17NxeZgPMkZj1AqeguClpL9v22GUm4ylivKWHodnJ64mP0yv1KAa+NMM+Ie1X761xtYrpGeJ9t+GLfZxigUkJxUuoFFiUSkJOdBpl5568Xy8uRbQrg+l20pE2jizzlCTtKStiHIGNujb0ca2W34nTe1CMRCjB4NpED/mkrYIEZc2cffN3+JE3zD3lIGjYHOJhIZ91m4xPkyWckQ5hDZPHXk1BwWzvEuQ/x4aI9II8Xfbjqol9x6bWtHex1RfMoPWT1Pw3I3dcYdb4RUHq5Ukt7SmHEX7A+32MLMbbZmy7BW1Z8MsykrmQoG1WTSlUXiOBF4Gg065N9eKj6x4aXroReEtqvnPDPIesZrO8YhWnNBNNlvPsee3/01ejwf4KK381Vqq8kAC9zfiNAzZNq4rbTfz6zZne4kf3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ity=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 2:47=E2=80=AFPM Luis Chamberlain wrote: > > On Tue, Sep 19, 2023 at 09:00:16AM -0700, Yosry Ahmed wrote: > > 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 sam= e high > > > > > > > order preference mechanism used for iomap buffered IO path as= used 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 requiremen= ts. > > > > > > > > > > > > > > Swap does not support high order folios for now, so make it o= rder 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 sh= mem > > > > > > 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 writte= n to > > > > > the device. > > > > > > > > > > I'll add more context in the V2. > > > > > > > > > > [1] https://protect2.fireeye.com/v1/url?k=3Da80aab33-c981be05-a80= b207c-000babff9b5d-b656d8860b04562f&q=3D1&e=3D46666acf-d70d-4e8d-8d00-b0278= 08ae400&u=3Dhttps%3A%2F%2Fkernelnewbies.org%2FKernelProjects%2Flarge-block-= size > > > > > [2] https://protect2.fireeye.com/v1/url?k=3D3f753ca2-5efe2994-3f7= 4b7ed-000babff9b5d-e678f885471555e3&q=3D1&e=3D46666acf-d70d-4e8d-8d00-b0278= 08ae400&u=3Dhttps%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2Fe%2F2PACX-1v= S7sQfw90S00l2rfOKm83Jlg0px8KxMQE4HHp_DKRGbAGcAV-xu6LITHBEc4xzVh9wLH6WM2lR0c= ZS8%2Fpubhtml%23 > > > > > [3] https://lore.kernel.org/all/ZQfbHloBUpDh+zCg@dread.disaster.a= rea/ > > > > > > > > > > > > It seems like we only enable high order folios if the "noswap" = mount > > > > > > option is used, which is fairly recent. I doubt it is widely us= ed. > > > > > > > > > > For now, I skipped the swap path as it currently lacks support fo= r > > > > > high order folios. But I'm currently looking into it as part of t= he LBS > > > > > 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 fol= ios > > > > 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 initia= l > > > 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/68= 9 > > > -Failed 5 of 730 tests > > > \ No newline at end of file > > > +Failures: generic/080 generic/103 generic/126 generic/193 generic/28= 5 generic/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. > > The tests which are failing seem be related to permissions, I could not > immediate decipher why, because as you suggest we'd just be doing the > silly thing of splitting large folios on writepage. > > I'd prefer we don't require swap until those regressions would be fixed. > > Note that part of the rationale to enable this work is to eventually > also extend swap code to support large order folios, so it is not like > this would be left as-is. It is just that it may take time to resolve > the kinks with swap. > > So I'd stick to nowap for now. > > The above tests also don't stress swap too, and if we do that I would > imagine we might see some other undesirable failures. > > Luis I thought we already have some notion of exercising swap with large shmem folios from THPs, so this shouldn't be new, but perhaps I am missing something.