Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4743348rdb; Fri, 29 Dec 2023 11:44:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHwSp5OQRAK9VS1j6P2yF2f47ann1h9zbJm8+aVv7hxfhJhyPi9rEnJe3KjvmSnCJTZQEo X-Received: by 2002:a05:620a:2956:b0:781:5ace:aa64 with SMTP id n22-20020a05620a295600b007815aceaa64mr6433382qkp.29.1703879084047; Fri, 29 Dec 2023 11:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703879084; cv=none; d=google.com; s=arc-20160816; b=HGAI5bDOvO35B5tHs0+r9QtHhxshjWJnHSN0laiwmubxf6WqsdnEc7uz624bHinE64 GrvYZJqWVaEwJRMFwyrMaBCQzgijQCGzfuAHCizLCBao+2U0pijGEoFmHm+b86jBbGjr b/zhsRXm4dlFoZ+hLLLOyvY56mVY/gJFXKqVZlnub3FORLbm30lbIys5HP6ZwDRUhfhf bmbPlkMMd0zYamSIyutUGtJTTbyFCLrgoCemDUMJlPoCIxWRUtU2uZu0QWqwsjGbTFjc 2QL+AAI8IbNYDT3pOPnRAZGSSykBYtX+0zpTVxqejKBEoH4pftWQihVzGkUzgSEaARla e1NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=dCpnguFez/RrYaco+okO0SwI4cUytBCQLHMCxfSWCMw=; fh=A11gMzHaVrNc1z2Qn51aG1CZv+VdO7ASxPd1rKuGYWA=; b=XcRRmvMstY3GonSaWu3HOQ/E5rFN8TOj7lhMTRYrE2TyirMxsx5rpYZRHFpTjULW8J y2m1BwHWYRhN53cf9ftWNudZe5Oz8QYoq2+XXNA9jVHS1HBr0ZMtcBZdL/RYXYEz2ftd PeNH7ADWz4+zpsdFCNzov8UTgMyq46UFXPtNmx/HX0FSS4NWRTcjRBeqaNNEbnPPNUuc OxRJBIxgNU+RHybaYkVGs4n4mbfYFvHthaipIlIE6vNjOZ6YmAG6aLLa2nlD5aHK9iLU rZVt/c5HB3PtksIFz2Bg/eleT7hH/hWG2ZhVtm51FbfN+xlYil5AIQ2TdoecoQ9Q1yen 8KvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=wVpZ6jPr; spf=pass (google.com: domain of linux-kernel+bounces-13216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13216-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v13-20020ae9e30d000000b00781205837efsi17212986qkf.4.2023.12.29.11.44.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 11:44:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=wVpZ6jPr; spf=pass (google.com: domain of linux-kernel+bounces-13216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13216-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C8F261C21612 for ; Fri, 29 Dec 2023 19:44:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E148134A5; Fri, 29 Dec 2023 19:44:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="wVpZ6jPr" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A572C134A0 for ; Fri, 29 Dec 2023 19:44:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7829C433C7; Fri, 29 Dec 2023 19:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1703879080; bh=ns1k4uVM2WW3ED0MkFvVFGjMioawgHcjU5xtCgOGIjw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=wVpZ6jPrKKPoOCPMaBquKZMt6vkoHZ7d2yQDRGa/2gydAcH5WmD4KjibPVoffWOoY KUl81fD5OI4W1AtvD817iwKXlFqEE2tFz8W7kyFA7hhVJZG/ZdOrC88W3YH/Pco7HM J4tPRxdIhT9JRSxqyC56wBvLXsvr3YGcAZVRTyL8= Date: Fri, 29 Dec 2023 11:44:39 -0800 From: Andrew Morton To: Zhongkun He Cc: hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou , Chris Li , Nhat Pham , Yosry Ahmed Subject: Re: [PATCH] mm: zswap: fix the lack of page lru flag in zswap_writeback_entry Message-Id: <20231229114439.e3f3a33652fdc1e6df666ab5@linux-foundation.org> In-Reply-To: <20231024142706.195517-1-hezhongkun.hzk@bytedance.com> References: <20231024142706.195517-1-hezhongkun.hzk@bytedance.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 24 Oct 2023 22:27:06 +0800 Zhongkun He wrote: > The zswap_writeback_entry() will add a page to the swap cache, decompress > the entry data into the page, and issue a bio write to write the page back > to the swap device. Move the page to the tail of lru list through > SetPageReclaim(page) and folio_rotate_reclaimable(). > > Currently, about half of the pages will fail to move to the tail of lru > list because there is no LRU flag in page which is not in the LRU list but > the cpu_fbatches. So fix it. Some reviewer input on this change would be helpful, please. Also, is there any measurable change in overall performance? > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -1139,6 +1139,11 @@ static int zswap_writeback_entry(struct zswap_entry *entry, > /* move it to the tail of the inactive list after end_writeback */ > SetPageReclaim(page); > > + if (!PageLRU(page)) { > + /* drain lru cache to help folio_rotate_reclaimable() */ > + lru_add_drain(); > + } > + > /* start writeback */ > __swap_writepage(page, &wbc); > put_page(page); > -- > 2.25.1 >