Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1034535rdb; Tue, 19 Sep 2023 19:16:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELddbaZPNheCtPfus5DMlMUxQ/AzHYt7SuVBgdUK0ChIbS6GJ84ofMwu9K+KfREO+jnmCj X-Received: by 2002:a05:6870:e394:b0:1d0:fd8d:2a10 with SMTP id x20-20020a056870e39400b001d0fd8d2a10mr1396188oad.44.1695176180447; Tue, 19 Sep 2023 19:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695176180; cv=none; d=google.com; s=arc-20160816; b=ysUFO+N8RA93lW2g8hy8mHuofvuPFwT6Z7vu2Scp7/XjJlfIktL1Rj4+qug6kMm/ic S5Kj7IT9rZkXO6OaDMsgHscHsom1DqQUe/ibYqIfrwbL7o4R0V5MX/v8fCpknY7Y5M/E xe93jfsXlisZAGv5FyGrZNLWWaKG1xxuN9sPu6SNF6nYc6eCSefGqtLWDaymZgIx9YoT eCSXnONlikObN/VOsMUQ+C8am6G1+cQqggAOjwJEprpVOW7b/d5cBZ+Inv9xkn09KTrv 5woxEcXQutbxUR8ya63AjkMyM2XH15FQhcoplA7LLumj9u99CkIdVI7qkIcvkZyJz7TB 9lSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=eliXjlnUj0/AODOfq0lfgn0v2M8TIN1LeS+hCeHav/U=; fh=5YS9MDihaO0rTfnohZkdewsTS35h/GfXmit4uaK2OzY=; b=as1tjYmT0xbXMXd4LaaztLYmc5gfXk6zhwPanFVkySEF4fCLWCC/kzKK++HU99oHEW jgSSxvw+6coas5AlK4OenjMk+UEvZRQNN4/4KJ4RbTlFAmDs6hqTT+7fzvWPbfaJebUV rMkeL1itSnWfavhEnS2m9uMck+sXt5JMdHdYg2Qs6I1nj4LhDkQL1PNKpI77RXP+Bifa T1U0aaMiwfiyWLRYYliWI7fDDn7FBwBqDLc75AYvR1uubACvSr/k0jm8ROFrgkOpGq6f wDLCfAIPh3TKHB7d4Kz2v7lTHPj1I+YFtFZybqED+h4Utv/uzg9l/h3zWVRLoXbqN3xx 0wrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OqQcER9J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id i22-20020aa79096000000b0068bdcfc3454si10403219pfa.135.2023.09.19.19.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 19:16:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OqQcER9J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9237C826ED2E; Tue, 19 Sep 2023 14:52:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233383AbjISVw2 (ORCPT + 99 others); Tue, 19 Sep 2023 17:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233233AbjISVw0 (ORCPT ); Tue, 19 Sep 2023 17:52:26 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02E5DC0 for ; Tue, 19 Sep 2023 14:52:18 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-99de884ad25so817787366b.3 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=vger.kernel.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=OqQcER9JyvuM3qJo1DI8aXd0lwL7//5LwyYR1Yul8THHQFKEDFCK4yMfMN3eJzl0hQ gnt9CSN/ob0M1v6MHpDZAIUK4Alr+RdxRShioyRHONzszT6OFK+gPH0HVhUu6Xm5yNiF SbtadUf9grV2X4kPLM71ljgOuy0lvMo7/DoCOmVW8QRDt0sXBzP2qSiyeOOnEjiJYhPJ itsBMVhncsnYmdY/jixCJ8dTfL93YB2HLoJXJm2tEEtQoYmnuYbXlBlet9TdvrZ8s2o+ /kkZnpGWr9NCunsQ5bYZl31NMKKtwIt7aj9U2+TOx4lvGsPLtblPRxZTGZ68MJ/IkhZJ a/jA== 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=FrFfzdz8hEYDKD7jRQg5YDoVERQ4Oc8Z+bQWi+zjZraP6k/1cWygn9scM4tSYXyORK QQEnHBAz/n3aO0++hYV1r3P9zIOZeeoS8t9QL8Z4r+hZxUVwunp7Qy/xklgO4Ufk2XON pJ0fgf7e+YWgImwTSm4WgXd0G2/9l3dKgQpNCIwkAZURdH5fY0rKajwg6XRv+2quM0Jo Wx1/a8kBO6dL86FAvVskfdIwbk+IsElKbJbOSpXZBZILx6PVeMrPWKhnfGXkZOxhHc3d Ehae7o0/GLdZ8XJIWMX9WsWbPB6apK01qpknn97ux6SSunfrwihFrXU4HA+5MH1OrPJA Dlqw== X-Gm-Message-State: AOJu0Yzf52FzVmM/kNmF7bjdpPg8muExmy/1D4NlPwo353TbNDguNw7y hzvqBXXuKzKk/mqjyMIi1i4H+st4kABSdk2OLlsNEA== 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-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 19 Sep 2023 14:52:35 -0700 (PDT) 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.