Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4857993rdb; Fri, 15 Sep 2023 14:47:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6wWXK//857wW2J7R/SDsJGHH6R3qCSYGWHogHTm/ba5PQlozOBkn2nsOxyimjm5fOwJef X-Received: by 2002:a05:6a00:2315:b0:68f:a5ff:3f3a with SMTP id h21-20020a056a00231500b0068fa5ff3f3amr3034147pfh.11.1694814466336; Fri, 15 Sep 2023 14:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694814466; cv=none; d=google.com; s=arc-20160816; b=PD1ytoATyWFFMONjtkTXIvWAN1N6OEjhd8tGXWDb3oAFtJqiyVMgxfcdES+WvgW4pY yVpIQV3mwzEymD5Br+xBpoIL0VV3j9hf/xqBIKjal+R3dvl671+Ew1zbdBCh3NNWomkB RPoAh8XHB483qhUjnBWsjJ+BPndyEYA7Fpk6SGIZQngBQQ0SyE9kFa+zdOIersWEDqnw muJ/rMg3OZ6z1nCLjuwCG3X9WjXYrdUPu1IJietRD1pk4KeftGeWtcIDFGP4q4e1GYU1 D+dmhK65mIz4ACNMhWRb21u6uINYtKL/3zVqYLyiouSSZTdinJHeWRIQuLmbKmQw6+yp OT5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BiPqqbuCoCJwT7cml3FIg1dZt/5325CvLgUU6B8VZPI=; fh=yNDO9rR/P9iQlnaCxyAHoU/xsWYQu6OYifiWU+pEdCs=; b=B5V4NiB+5n5+m6NBrYqjLHbueUSsm4J+bH5B4q29UO7le1aIOVydvaQQd83ytYQkC7 AqxniucXBZOWonSTIZtx/kpHeDBEXtbHmtzbD/Ai5vzhX6PAFOU4YCqLItKjjq9NsOAI noI0RNRnC5DkeGedVa9s8MCU8VIjSSw0GPEstpgchO6cmXXhTMLcqYEUdiLm8XgRebQm No0GaXBlaBv/QwprdXRZLjgeh/0iOhM/zvNXL+4KCDfkByEZxCXkJqnOV9qMOSSXZKkh zmjqJloaOymiehhLR7OkA/Sg/eBDVcwe2rvheh+o6lWqmJEPi9jgLhgdAndn6JA6Zv1p UZdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WnqCDQbw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t186-20020a6381c3000000b00543a89c95c2si3854538pgd.207.2023.09.15.14.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 14:47:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WnqCDQbw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E0D60816688F; Fri, 15 Sep 2023 08:35:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236016AbjIOPfK (ORCPT + 99 others); Fri, 15 Sep 2023 11:35:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231349AbjIOPfJ (ORCPT ); Fri, 15 Sep 2023 11:35:09 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95746F3; Fri, 15 Sep 2023 08:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BiPqqbuCoCJwT7cml3FIg1dZt/5325CvLgUU6B8VZPI=; b=WnqCDQbwPSmkZQOH3XpBhxlOB4 Hf8TM/ShP+TANJO0GVAK3VYfdj33ab9xx/LVhg422oglIHaMJlu//v5xlqpc5FidCjldVxm5F5HCt RsMIx7xUQHGI8xA1mvs2nvLOiVryITICXLBFkakSxO9YiJHTheLXp2chiBFvPbbY/lS4/TMqwdLC0 V6eY01zys5j9cSxLIyTFOei2USk/mipe17dMsrFjr0JvKVPRnc/SVxUBIL4TtoGVARdhern+1WRxa oHksp7hZoCLOB+UK4mg0+oUkJl5cvKo++ELseTENIW9FXic6yq21wesS02/L5b/yY1t1UtuFC+aFs JlRbGrcQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qhAqM-00AWs4-Oi; Fri, 15 Sep 2023 15:34:54 +0000 Date: Fri, 15 Sep 2023 16:34:54 +0100 From: Matthew Wilcox To: David Hildenbrand Cc: Daniel Gomez , "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.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 Subject: Re: [PATCH 0/6] shmem: high order folios support in write path Message-ID: References: <20230915095042.1320180-1-da.gomez@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 08:35:41 -0700 (PDT) On Fri, Sep 15, 2023 at 05:29:51PM +0200, David Hildenbrand wrote: > On 15.09.23 11:51, Daniel Gomez wrote: > > This series add support for high order folios in shmem write > > path. > > There are at least 2 cases/topics to handle that I'd appreciate > > feedback. > > 1. With the new strategy, you might end up with a folio order matching > > HPAGE_PMD_ORDER. However, we won't respect the 'huge' flag anymore if > > THP is enabled. > > 2. When the above (1.) occurs, the code skips the huge path, so > > xa_find with hindex is skipped. > > Similar to large anon folios (but different to large non-shmem folios in the > pagecache), this can result in memory waste. No, it can't. This patchset triggers only on write, not on read or page fault, and it's conservative, so it will only allocate folios which are entirely covered by the write. IOW this is memory we must allocate in order to satisfy the write; we're just allocating it in larger chunks when we can.