Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp657010rdb; Mon, 15 Jan 2024 09:11:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPQDrgV4lB+TIqpTHV6RgpurZAexLAXg/zP9hhEcDg2db8EbgU0J6bGQTVcDT70bSvt9wQ X-Received: by 2002:a19:4f13:0:b0:50e:4810:d1ce with SMTP id d19-20020a194f13000000b0050e4810d1cemr1369044lfb.168.1705338708189; Mon, 15 Jan 2024 09:11:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705338708; cv=none; d=google.com; s=arc-20160816; b=SchiqaaSOQuB6HUhGfKqXorM4VTZH+/LKXfkFIwAabB4rcYaL4VgKduPjGtgyuD7NM ZDAn7tbHvsN3svH6tZOnoqhRIKIMUBasdM59yfkRKZ3QkmWc0a5xcc85P3RC00NUId0s at8g97MbNE9FzJpYbX5PaGvKa+skcHghh/9nbjTRNABdwHilCmGCTNrSUPEzuR0YkIEb f1exFrc71JFq3rHl1UbWDra3KToi/GxhgaqUGDbu6Z9e3pXm57ME2zQfvOHMAFTPkalc KX4/COm80u1z1fmvTSuZoFXPywMQGaGsaSDt/ih1TEwBZg7ToCicoQCtYfp4r3QpmXXp mRJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=IqN1HXQI0vB7XDw+H37JNuIh2GbV9Tph7FvOP9587hA=; fh=3Te4VzrR19Xj6LU2ZBrLkQucW4yaq3NF6TKWnMSnzLY=; b=Xbcpf1E7pWAN7kWeZe71ujrohUH/S8oyVdX/mMHtRPm5ijLFTC9HHiZBPMhi5+Yajb cH6WNROkWB8JW7RKwCBaKRCJsP3WAr4cYgvC98nfI0S7zRYBianVV+rw9BnZcVj/QCs9 dzJUx7/xQDXyraa+GdVGQxCa/nYmF0++W+zgIVjZi/j9oaYzmtbY6rNP6UMB3RErUF30 Qdk4Gpft5zB2dCxOKqiH5sf4JPGe0wtUswDhAaQhffYHHp+HsUvUXXWEw7fTGLo6b1p6 CIUBwkvjulfjN/y0AwIUrXQokDr2YnrMbM83dUJ7uxvB4+p4p26EA5lPCVIUucQWwa2S xNEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S9SZ7GCK; spf=pass (google.com: domain of linux-kernel+bounces-26298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u10-20020a17090626ca00b00a2da582ce53si1177827ejc.467.2024.01.15.09.11.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 09:11:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S9SZ7GCK; spf=pass (google.com: domain of linux-kernel+bounces-26298-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id B518C1F22922 for ; Mon, 15 Jan 2024 17:11:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0677617C7C; Mon, 15 Jan 2024 17:11:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S9SZ7GCK" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B937917C6D for ; Mon, 15 Jan 2024 17:11:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2cd17a979bcso100688451fa.0 for ; Mon, 15 Jan 2024 09:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705338698; x=1705943498; 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=IqN1HXQI0vB7XDw+H37JNuIh2GbV9Tph7FvOP9587hA=; b=S9SZ7GCKS15KY7cZ7vfOODL6vjMnS3RDrykIyjUqtH/u6nxnKTZrwLEUhjzyMHwjrn 66mGimnqVxEEUY3c4uxH2NQ7Jp1m7PgVxpmj+cOWgc4/2vWwrL2vm+XHjPUwUU38muUU DTHPAQmEbzj5T/a1mWxpvlzqyzyDi20goLWZLuJEOx500oxDjz/vnddzu0ToiXJyMHg4 sSmLs07Sjf350gh6r+vFSvLJG+XYpbH38YPZYz8+xbJlWwJTJ1EatZzQ+ZGkWLq/uUhp CDg5LWsg0fdvxMyGjHrE+DP2zDotwpgCl+UBdS/02FRFKVZHrb7MmuWGGYUE3EwigNCV 0HCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705338698; x=1705943498; 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=IqN1HXQI0vB7XDw+H37JNuIh2GbV9Tph7FvOP9587hA=; b=wf02yBapzSLSOYt4LDuZtTSi0XZjTFHYrf3bewOMtufeqbreLuYjsn+/+EpNvOj8TA X959BUeHARC0XYwnEE3vM0tGOYbzmqVuyaURd7oiRB4it3r+gDLts+oj5mbooUE87Zlu f38E6wqpiKhr7/F66oMO2Iy1WD63UxuSiF7mbNvijMTTZ7bMw5wY63cG/6tYl3AuwFpd vt9bdwsAPgQuArpDQFBb/IBVVvFavilaqreKpZ459FyxGoqaBphTlRZp+9CERYeUthhr GOcS8es2HlMLZmPJ71dmMac1iDllQsNqrIxTwsJPVHsq1O1fLOAasMeRspghuSEhA2E+ W2CQ== X-Gm-Message-State: AOJu0YwvIJIw6J5gLKLSqrJsV/KtOFE74cse4PLCGnnsmxe/JkEpSKVf LuNHfVBU//ZlUns9Jhcd6xHhtjiq9/CExqTIC78= X-Received: by 2002:a2e:9e97:0:b0:2cc:606b:fcfd with SMTP id f23-20020a2e9e97000000b002cc606bfcfdmr1229911ljk.167.1705338697681; Mon, 15 Jan 2024 09:11:37 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240102175338.62012-1-ryncsn@gmail.com> <20240102175338.62012-7-ryncsn@gmail.com> <87a5pg9qno.fsf@yhuang6-desk2.ccr.corp.intel.com> <87wmsb1ia8.fsf@yhuang6-desk2.ccr.corp.intel.com> In-Reply-To: <87wmsb1ia8.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Kairui Song Date: Tue, 16 Jan 2024 01:11:20 +0800 Message-ID: Subject: Re: [PATCH v2 6/9] mm/swap: handle swapcache lookup in swapin_entry To: "Huang, Ying" Cc: linux-mm@kvack.org, Andrew Morton , Chris Li , Hugh Dickins , Johannes Weiner , Matthew Wilcox , Michal Hocko , Yosry Ahmed , David Hildenbrand , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Huang, Ying =E4=BA=8E2024=E5=B9=B41=E6=9C=8815=E6=97= =A5=E5=91=A8=E4=B8=80 09:47=E5=86=99=E9=81=93=EF=BC=9A > > Kairui Song writes: > > > Huang, Ying =E4=BA=8E2024=E5=B9=B41=E6=9C=888=E6= =97=A5=E5=91=A8=E4=B8=80 16:28=E5=86=99=E9=81=93=EF=BC=9A > >> > >> Kairui Song writes: > >> > >> > From: Kairui Song > >> > > >> > Since all callers of swapin_entry need to check the swap cache first= , we > >> > can merge this common routine into swapin_entry, so it can be shared= and > >> > optimized later. > >> > > >> > Also introduce a enum to better represent possible swap cache usage,= and > >> > add some comments about it, make the usage of swap cache easier to > >> > understand. > >> > >> I don't find any benefit to do this. The code line number isn't > >> reduced. The concept of swap cache isn't hided either. > > > > Hi Ying > > > > Thanks for the comments. > > > > Maybe I should squash this with the following commit? The following > > commit want to do cache lookup in swapin_entry to avoid a redundant > > shadow lookup, it can help to improve the performance by about 4% for > > swapin path. > > It's good to improve performance. But I don't think we must put > swap_cache_get_folio() in swapin_entry() to do that. We can just get > "shadow" from swap_cache_get_folio() and pass it to swapin_entry(). Good idea. My only concern is, if the argument list is getting too long (7 args if we added all mpol, ilx, shadow here), will that cause issue for readability or performance?