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 37DADC35274 for ; Thu, 21 Dec 2023 06:33:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C0DB78D0002; Thu, 21 Dec 2023 01:33:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B97758D0001; Thu, 21 Dec 2023 01:33:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A36FE8D0002; Thu, 21 Dec 2023 01:33:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8CDEF8D0001 for ; Thu, 21 Dec 2023 01:33:15 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 60039C0A1C for ; Thu, 21 Dec 2023 06:33:15 +0000 (UTC) X-FDA: 81589858350.16.0DDE87A Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by imf05.hostedemail.com (Postfix) with ESMTP id 99BB4100017 for ; Thu, 21 Dec 2023 06:33:13 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rJrKSEv9; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of yuzhao@google.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=yuzhao@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703140393; 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=6XLaf/t8QZCPicOYEZHL1NswpRFe8OmInfrsmUccFuo=; b=J6Mk2ligSrVugbVkB3zKZPSHOijG9ecINf+FDBTeAImCF/X2eKfOEjE7E2mrQ0AZZB+LXB 4H/Wwho8muU2mitAhWNdLXx9NHYKNUiVGJNqOvbhMO3XzmX4amz7PJ3L8ZynaaZUa8X0y+ j8cWXVrPm/X2nArT1GBodfAsogkbi5Y= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rJrKSEv9; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of yuzhao@google.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=yuzhao@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703140393; a=rsa-sha256; cv=none; b=N9TX73xqfkgxomHu781hFwhukYdSMF7ynHIoTE/jMsG6Cur7rdUTbqPbj1/rKtowj6HBcZ R9O3N9XLK5VRmq0hcBlWu27IUOD8PPM83DLLFIdMXvMORtzGPZLprMRJkMy23uQ+TJUrjC 5iYb6D4FwAR897OaHanFNyzNOGU3ro8= Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-40c32bea30dso38755e9.0 for ; Wed, 20 Dec 2023 22:33:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1703140392; x=1703745192; darn=kvack.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=6XLaf/t8QZCPicOYEZHL1NswpRFe8OmInfrsmUccFuo=; b=rJrKSEv9H4Vdp/IH2c7ZWBsXEa4ZItk7rcfsuYfCaveEzy4JPGGIoh2SIwOPE+jrk9 hQ4v7/8GYDg0uYlnu52mWYO1HlY5LtnX5Fo9gcF+UbCMiAaipSmQ6pJT/l5rGJ7yu5wA KDbnXv8tZzGg800+apwaFueMuLF0Xc2TDUfwYu28wikf8G87y+XrfiileenY4GGfmZTU l013VZ24Bya5d0Nk3vxlxxmjQwQH0OF/NNMXcLpH4PnjC9HN2o3aEj9320nLFBtHCI3f gLRD7j3w2D3WL6JI3S2wZj/DzWOWHJHy9pmPDfOyYKGu3nfh//Ddu6wxvVRe8ueDCEn4 J17Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703140392; x=1703745192; 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=6XLaf/t8QZCPicOYEZHL1NswpRFe8OmInfrsmUccFuo=; b=h2+GpM1wgxwgWSsgPJRwfbOATqbBhsZ6vJTFzOPGUOgdB6LsBDTZQEAfRpAqmjMreK iWrAktmXm7u2cv4LkMVh9X65sc352p5RiC7z2udevgWT4He1BmWypx6DMfXbfcVI/8Nb 9+4ypBLjILeux3EebAKWC1zwgbIvb1i49GH4P6Yzm1yXWRDm+utCx3Qfe+YCrG1I7P80 RqPtFAeS56NgNFMJiwX+4wAYpcoZOGWAWmKb/qEWRMnDtNN+UibOySWqirZaDSseo2v7 DK3cII6O3UdJbLTo2lNfjy6jkw+xrPtr7rZ+rcqUDXmr9QLrxdF1hD3FKyvrNRFzZDmk hPVQ== X-Gm-Message-State: AOJu0YyUWF8nQQ/xVQyeNVBs+/YZ8hyY8SvcwmEnKaRaE4m3KBti0gku cbviKUnPw0sgNNiMM/THV7vq1uQlrmSj664Yc/FycFmGrDpn X-Google-Smtp-Source: AGHT+IGY75EmIU0eB5GLh9y7veQOGX13D9QV7QVXa+jRYUYg+CX044PEkIJvqDgjXljnRIdy1U2TEtu8uhsKBzAJ6o0= X-Received: by 2002:a05:600c:4b10:b0:40d:3f65:7e8b with SMTP id i16-20020a05600c4b1000b0040d3f657e8bmr17501wmp.1.1703140391796; Wed, 20 Dec 2023 22:33:11 -0800 (PST) MIME-Version: 1.0 References: <20231220102948.1963798-1-zhaoyang.huang@unisoc.com> In-Reply-To: From: Yu Zhao Date: Wed, 20 Dec 2023 23:32:35 -0700 Message-ID: Subject: Re: [RFC PATCH 1/1] mm: mark folio accessed in minor fault To: Zhaoyang Huang Cc: Matthew Wilcox , "zhaoyang.huang" , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, steve.kang@unisoc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 99BB4100017 X-Stat-Signature: snx6nx4r9hsyoseeas7mzwxpu9ynfu76 X-Rspam-User: X-HE-Tag: 1703140393-559748 X-HE-Meta: U2FsdGVkX19pN2lDepdZhe+cM/nlP6zex4Vx2sdQCCH+LeyORs3PQE80SG7vOdHKgKaDVhn+pTVOxjf+vM4wq3z6iVmvu+RlKvo1X8umRIpI620kdhl6EivodwlZT/bvedDQwByDtZ/2vW+RgsaWqdrG81LVRaEYNzOVnHJUt6uIOTL5KSunnfvsJexEK/6hka4Lh53/mVmaykR/ljMNQH0I18AnYm898HWU7buBZt4Vqzk2cA+1AT0VCadF2QgMVu0phoKgO80yggs8fHj6JsblD/hz1dOciysMitJ+ydHi+Yk6CvGCjcEWiWHC4k1Kqn5tlHQTVtIk/vxBPDcROR+GqeSamtxDQdQdkyGHK/rrty8puqcldllro91apGEiglDnRntRZetU2YK55T/wz54CFbsuYVJDkmeJRLK4BeiD2R4qwzEm3U9F1TEygxwntDtjRt8fW6MmFSd5h5zDwzph2JoOVC8CGTXv+izzRAEQWgFNDaMUjR6N0WvYiCDgSuclqLCcXJPPRhc+s+H4ExIQp8oyTEnAGrI606TVwt4aEZg4ByLtoOlds4nMZajZuVu+v6NlmpU1bGcMtxH/e7yK5dhevMAUo9S+ne60FyAMQmfonZomRNluHSEMxTPU1B75j+UB4Bg0HWStxvfGZAlxcb6CKkE5vYSvf8X7p7Hg02kO7f/twYWHTwyYqv2iPrjKONouj9Y/V8MvNh3/noqT6jXh0zctcUmRLy4aoqrSRJBHcy291xZuEwKIOFTnz+G5OYYn4WCGBA0IkRGbvHro9nOLEbobdGHAzJ/G96j/HsqpMsijt5zYYYMBE48YZeUixDJIcgm9Q8BmfTF2Clj80+I23pO3iH2I8KvbB/Rr5br79e4cvEGNZomugpZM2Ru7tBMXaDWDjwVt90SkPMaGTQkIvXYARrZ1asWa0UNT5XOJOKDAIZwpxlHaYabzbEONlApxOB49FH9wJJX l8NXLKYQ 5oqnDt5ehVPVUAfMa+VxnS+Hau7Gxz3NO9pIs2awHP6YT7vR9u/L4xCjPw2ISiX6QZPyzBYZ5zF2yxJHBFMgp4OeXUmGvrI0g/YYBPtZHoDmHsdj+UlCr7BxmK6paawhyPv9lUieMvJxTIJZsPvK8akrU3eogU2exWurk7eIwmFGyu838/VT0AQePWY7WP/qmyFlEynu2JBZK7T5ChSo+aDO6gUPkUeCD1tOZztHaREuEcLM9X3lbfPw4FYJydlbs4s6cdMCqupTcF2+bbBFz/38cidLkABMaKKNgqTEYWQaWrmcnNDJKBeLLdrF2ogJ0uKFKVoII4qp/zMnwyNqmsdGENX0zAdUoNlyOVr22HfQMAMofsCN4dvi4CN7DyDY0fIjGoI/O1n3Xi3E= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Dec 20, 2023 at 11:28=E2=80=AFPM Zhaoyang Huang wrote: > > On Thu, Dec 21, 2023 at 12:53=E2=80=AFPM Yu Zhao wrot= e: > > > > On Wed, Dec 20, 2023 at 9:09=E2=80=AFPM Matthew Wilcox wrote: > > > > > > On Thu, Dec 21, 2023 at 09:58:25AM +0800, Zhaoyang Huang wrote: > > > > On Wed, Dec 20, 2023 at 10:14=E2=80=AFPM Matthew Wilcox wrote: > > > > > > > > > > On Wed, Dec 20, 2023 at 06:29:48PM +0800, zhaoyang.huang wrote: > > > > > > From: Zhaoyang Huang > > > > > > > > > > > > Inactive mapped folio will be promoted to active only when it i= s > > > > > > scanned in shrink_inactive_list, while the vfs folio will do th= is > > > > > > immidiatly when it is accessed. These will introduce two affect= ions: > > > > > > > > > > > > 1. NR_ACTIVE_FILE is not accurate as expected. > > > > > > 2. Low reclaiming efficiency caused by dummy nactive folio whic= h should > > > > > > be kept as earlier as shrink_active_list. > > > > > > > > > > > > I would like to suggest mark the folio be accessed in minor fau= lt to > > > > > > solve this situation. > > > > > > > > > > This isn't going to be as effective as you imagine. Almost all f= ile > > > > > faults are handled through filemap_map_pages(). So I must ask, w= hat > > > > > testing have you done with this patch? > > > > > > > > > > And while you're gathering data, what effect would this patch hav= e on your > > > > > workloads? > > > > Thanks for heads-up, I am out of date for readahead mechanism. My g= oal > > > > > > It's not a terribly new mechanism ... filemap_map_pages() was added n= ine > > > years ago in 2014 by commit f1820361f83d > > > > > > > is to have mapped file pages behave like other pages which could be > > > > promoted immediately when they are accessed. I will update the patc= h > > > > and provide benchmark data in new patch set. > > > > > > Understood. I don't know the history of this, so I'm not sure if the > > > decision to not mark folios as accessed here was intentional or not. > > > I suspect it's entirely unintentional. > > > > It's intentional. For the active/inactive LRU, all folios start > > inactive. The first scan of a folio transfers the A-bit (if it's set > > during the initial fault) to PG_referenced; the second scan of this > > folio, if the A-bit is set again, moves it to the active list. This > > way single-use folios, i.e., folios mapped for file streaming, can be > > reclaimed quickly, since they are "demoted" rather than "promoted" on > > the second scan. This RFC would regress memory streaming workloads. > Thanks. Please correct me if I am wrong. IMO, there will be no > minor-fault for single-use folios Why not? What prevents a specific *access pattern* from triggering minor fa= ults? > which means RFC could behave the > same as mainline does now? I think it doesn't make sense to have > multiple-mapped pages filled in page_list to shrink_page_list since we > can distinguish them in advance.