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 D75D7C4332F for ; Mon, 12 Dec 2022 14:41:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D4AD8E0003; Mon, 12 Dec 2022 09:41:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5842A8E0002; Mon, 12 Dec 2022 09:41:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 424B28E0003; Mon, 12 Dec 2022 09:41:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2E1F88E0002 for ; Mon, 12 Dec 2022 09:41:58 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 08FBC1202B7 for ; Mon, 12 Dec 2022 14:41:58 +0000 (UTC) X-FDA: 80233918716.02.182C6CE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 6671140015 for ; Mon, 12 Dec 2022 14:41:56 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=n8xLMOU0; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of chao@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chao@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670856116; 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=LetN+XiWqXiD7iYQvUHGp3bU4cjZ7Jb9FiyZhg2I1Dk=; b=bDtgheptLhbqxp62xETZ+u5G4QHKo4XoSThfDHhpBhCBFqHFH4cJaBeWXWPKIz5KCzhxb7 f52UfbGD+gNymtjgD5YlD1E6jJolhQixgNL9YKSZpQWkxe0PXD38BerB3WiE6iAnwRI2ma wxZGLErtsFL7hL+1p85TVM8XoD7eJMo= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=n8xLMOU0; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of chao@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chao@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670856116; a=rsa-sha256; cv=none; b=FZo1gqQSdk3psWQ0kWYbP+3xcp7TIsjZuCjQwOuuBUnrI7FbZOE8ocZD7VoAwEMWd7yQEf jzDXUsma9qqTy/zm6YOB2OAJvDsl4nzrbrje1iE837Hf/JeXYeSouFbh2hX5oaqqsBEP5Q aSh8Zod8wN9F1CfnTXNw/eMVIjBxQ2g= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 656306111A; Mon, 12 Dec 2022 14:41:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CE0C433EF; Mon, 12 Dec 2022 14:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670856114; bh=49yiOOZXNHxawLGdF5jaeIemWnDUH+xC0nzErDnYjL4=; h=Date:To:Cc:References:From:Subject:In-Reply-To:From; b=n8xLMOU0bLG+06pQhoH9AbcOhe69C8Zly9RLAQ10uYBXbidwiMeWjZOvalz0iy3SD bheByXSHQ+WLsHN9KFYet/HV67Uj437+Q5xUEZP4ATjRAn0VGj8QOEm04zMRlp8MPe faogHkgm3YP1getVruEGkC4Lh1MR86MRnQJND1kfBzaQRawe5X3zL9S8LmY8RGBwya igwos3kMQ4claGjqRPg/VcBFUMKS3jOOwAnrAvdZ/1hX61RtYcwBA6LW86t7ksM/rc UW0Vnz7D5hGc38jpAX6MiZ31A969eZ+YuzJlUYUOG1or01nYfPtY2cU4bYkDtv/MS3 0vUsMTm8qvbCw== Message-ID: <0a95ba7b-9335-ce03-0f47-5d9f4cce988f@kernel.org> Date: Mon, 12 Dec 2022 22:41:52 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Content-Language: en-US To: Vishal Moola Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org, fengnan chang , linux-fsdevel@vger.kernel.org References: <20221017202451.4951-1-vishal.moola@gmail.com> <20221017202451.4951-15-vishal.moola@gmail.com> <9c01bb74-97b3-d1c0-6a5f-dc8b11113e1a@kernel.org> From: Chao Yu Subject: Re: [f2fs-dev] [PATCH v3 14/23] f2fs: Convert f2fs_write_cache_pages() to use filemap_get_folios_tag() In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 6671140015 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: gf4keo51ucjterbr4mtk5pmwiwe9k76e X-HE-Tag: 1670856116-915457 X-HE-Meta: U2FsdGVkX1+I+6HjBN4cYR5P0QyAU6UAt1KD2kREXYxAfPwHwm7El+B5c9fld2Id1LRz3o7dpZrZ/AtVFRfV6vPfo3G+P8b7boXdYThmmJDG6pCQrqmkNQxmWT96E+7iq8KmafCoN6TY4KwEMPsuV6QsjaBWddLLnvVd2ZO0GN9oVlcfQk19Ax1l0Ldh0bL0ORFI25SP1H6DhaJga39J3O4eJJ2lvsEsIdQQe+pALuILQpipihJU4nqYqlahJlHVF3TcERynAchRcxVDD9K6ASpmJVJu4TRGi7FteoIzGkc1ovQkilKDuBkm5wYxrzNaYWO1hTqxkj1e02CLDI+M7GyOuwk6oPgh1MWVxMvZSry+PnH4ZFIZan2KurSJCKN0hrlnfFrW/T3JJyKXktS9aVfUDMl83CQKSLIMbtGOyEMswvGyU8/JTEIq7/7hX0p063qNygzRMOoY721JqPVH6IaNpDdY5cDTp2Tol8JVJP64hj3iP5N2n/IQUIRSC3pT0fdiuPBm1unmg63wgM9FcUOy9bwbYaqbrfzsUycWI2koIS2H6f+WdbjIeTFs6jZnG1bh3MZ8t8FCKF36iZQ2TdYePah2kJqQo6RIl4zUc84uAK3NtkR/T/SZ+3S4+MzteEkd5Gj5HaLC1998CSan6Wu8/lY1zliztAZ+gihN+FXn4TEldLK3AFAby0NXKuy+lKTxgBMPnQVCTOBUh0Y/EBwAJOBZ63Zjb0S73KVrXHpjvTLa5XSlpTxARnfVmqNdizMqHRD5GXm7ZcNTMPqmh43moPPfJlacKHAfXdHreY7kX+rwaNX9hXMWwAUHU9pxm1p+/4KO/r4XE22A/yA+l1ZSiula52QG7wZRPugKe0Q4V6YdQqa03JM/q65rrUOYohFAfYRC4abnKykgGB59u6Flu3Y54d1H19HNQYjFj8LWMv/Jz58HUedCyeHSZRy8Edb9Coil4Ek41H+M5lo s4vF+0TG XYaNb6y8ipgqgK3ej6s97Ey6DySAjug1DrD4ad57eIOEVYNwtNw7rmcjgDldWGgA4pAQ7Wd4yOo6ohiBATy6ZVw6xIFbbMOEmCDs0hPuic0JiN1X+fC53LIlllUJ1rsrPtWWQ/AXXW5RcXkWkYp1NGUEcsw== 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: Hi Vishal, Sorry for the delay reply. On 2022/12/6 4:34, Vishal Moola wrote: > On Tue, Nov 22, 2022 at 6:26 PM Vishal Moola wrote: >> >> On Mon, Nov 14, 2022 at 1:38 PM Vishal Moola wrote: >>> >>> On Sun, Nov 13, 2022 at 11:02 PM Chao Yu wrote: >>>> >>>> On 2022/10/18 4:24, Vishal Moola (Oracle) wrote: >>>>> Converted the function to use a folio_batch instead of pagevec. This is in >>>>> preparation for the removal of find_get_pages_range_tag(). >>>>> >>>>> Also modified f2fs_all_cluster_page_ready to take in a folio_batch instead >>>>> of pagevec. This does NOT support large folios. The function currently >>>> >>>> Vishal, >>>> >>>> It looks this patch tries to revert Fengnan's change: >>>> >>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=01fc4b9a6ed8eacb64e5609bab7ac963e1c7e486 >>>> >>>> How about doing some tests to evaluate its performance effect? >>> >>> Yeah I'll play around with it to see how much of a difference it makes. >> >> I did some testing. Looks like reverting Fengnan's change allows for >> occasional, but significant, spikes in write latency. I'll work on a variation >> of the patch that maintains the use of F2FS_ONSTACK_PAGES and send >> that in the next version of the patch series. Thanks for pointing that out! > > Following Matthew's comment, I'm thinking we should go with this patch > as is. The numbers between both variations did not have substantial > differences with regard to latency. > > While the new variant would maintain the use of F2FS_ONSTACK_PAGES, > the code becomes messier and would end up limiting the number of > folios written back once large folio support is added. This means it would > have to be converted down to this version later anyways. > > Does leaving this patch as is sound good to you? > > For reference, here's what the version continuing to use a page > array of size F2FS_ONSTACK_PAGES would change: > > + nr_pages = 0; > +again: > + nr_folios = filemap_get_folios_tag(mapping, &index, end, > + tag, &fbatch); > + if (nr_folios == 0) { > + if (nr_pages) > + goto write; > + goto write; Duplicated code. > break; > + } > > + for (i = 0; i < nr_folios; i++) { > + struct folio* folio = fbatch.folios[i]; > + > + idx = 0; > + p = folio_nr_pages(folio); > +add_more: > + pages[nr_pages] = folio_page(folio,idx); > + folio_ref_inc(folio); > + if (++nr_pages == F2FS_ONSTACK_PAGES) { > + index = folio->index + idx + 1; > + folio_batch_release(&fbatch); > + goto write; > + } > + if (++idx < p) > + goto add_more; > + } > + folio_batch_release(&fbatch); > + goto again; > +write: Looks fine to me, can you please send a formal patch? Thanks, > >> How do the remaining f2fs patches in the series look to you? >> Patch 16/23 f2fs_sync_meta_pages() in particular seems like it may >> be prone to problems. If there are any changes that need to be made to >> it I can include those in the next version as well. > > Thanks for reviewing the patches so far. I wanted to follow up on asking > for review of the last couple of patches.