From patchwork Thu Oct 31 10:37:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?6KejIOWSj+aihQ==?= X-Patchwork-Id: 13857795 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 0C72BE68974 for ; Thu, 31 Oct 2024 10:37:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 832E06B0082; Thu, 31 Oct 2024 06:37:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E31F6B0083; Thu, 31 Oct 2024 06:37:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65C6B6B0088; Thu, 31 Oct 2024 06:37:22 -0400 (EDT) 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 3E9446B0082 for ; Thu, 31 Oct 2024 06:37:22 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B11321C7060 for ; Thu, 31 Oct 2024 10:37:21 +0000 (UTC) X-FDA: 82733544726.12.0A8EA46 Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2101.outbound.protection.outlook.com [40.92.62.101]) by imf25.hostedemail.com (Postfix) with ESMTP id 4A677A0005 for ; Thu, 31 Oct 2024 10:36:58 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=MBCoCHgf; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf25.hostedemail.com: domain of xieym_ict@hotmail.com designates 40.92.62.101 as permitted sender) smtp.mailfrom=xieym_ict@hotmail.com; dmarc=pass (policy=none) header.from=hotmail.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730370994; 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=JMcMdght30/eI6mnwcQoOI4r3nLofsuifIdbBPkDc/s=; b=KbuabvHw9FRGffC+EgBtt3EbKamSBLIQxDP4vg73cUfuEleJFgwyopCRM3CMupwXW2huJQ iPRrI8wQ2ojH2z+pq8DJY9XWJVQxF5pAKxDhOsH0cQw7MlNMPmFE47VqKGPAC+/RO8yaDi k0mCXRI84vnoUAeEvifbXFJ7bZvSB9U= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1730370994; a=rsa-sha256; cv=pass; b=R5Zu1nVGsaB1L6VKxUMmSTVSvEomIcRaJyc3z2snVXRmRrFI0ntInnNwCjJ1OxFBi724t4 lMJflLSkbwIy63ODSgXM1CAa6TXbt+Fo5xLEqnz6ddo5dwAvnoHKrmbnQwVCS7QnTVVHhy ObgcOvcuqJY4pG2bP0BnSrawf72QpPk= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=MBCoCHgf; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf25.hostedemail.com: domain of xieym_ict@hotmail.com designates 40.92.62.101 as permitted sender) smtp.mailfrom=xieym_ict@hotmail.com; dmarc=pass (policy=none) header.from=hotmail.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BKYp2DHIWST15xMHm0EYPV6n4xIG2+/BuR97SZQVIdjJY686Xmi345FnjaGgHrF2dojh9/cWJakJiY+6bW0lY8MFayvUYqGkrrGM9WxYvb/OdRuzuV0DeM8r0BqCUgxFwn1LiAQOYvOnNUu44ul2Qt+Sa9rS/bBVLFW0tmffmbFTUGMv5yUcxnfhqPgwlqYTx5J+pUaLNlv+8BJqVOQS30pl7b7xssvEbF3uA5krQgDqZ4rhr69Ndty2ZmU1ohpjsixMKH5ELOXNbP4f279s4MZLaT/PiCVwsD+xFTol1p4ihgjOAYmG+88xgbOj/M+bqn2Q+ddcD+ZcR1TLyBqG7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JMcMdght30/eI6mnwcQoOI4r3nLofsuifIdbBPkDc/s=; b=uP1ysPUBZh46hlZ9OFEizMobh5zCUrZSIM6J8vQqiPM3N3iFWjWdnD7H2B8bMurTIsVmw1Apsa/wj92nxc/i2I5EntONhIKK53OYRtAIxcyoXpnWkhJDa9QTfb9Jo6fdi7AJNep2KgfHRCjvr+hqqJvFkGWlB8yrST/1+tFjpoH9+OiqBtYCKG0ybyfdKR9tgcNrlDN/PZrnpEeskd78H0sC3w3gQNgJbNPBx3QUahhLVM798ICP7xZu4NyROQgy4nH4SYmviYW3VEDUwrfBZ8dpfuz/VzvQmrADghTb+hYa/z0vHPPplsDo7GRHaQ4SSLAr5odr0dVanwo1q1pO6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JMcMdght30/eI6mnwcQoOI4r3nLofsuifIdbBPkDc/s=; b=MBCoCHgfNFRmiXjAsZG0AgxD+gaiPBmNSLJiHpxGUG5MJq205th8WlM4RWN0Av/NS2h4CKU3qw6QFLVRbSIyMeHFK//1Z5DrUkeQfoZhaGRKlLtfE7M8c25f04bIpTyTyv7zxHm7G+lLyLaCaVGIFSGpIE3/i/vgqMnsCFTjnkRn+GcnqP9Flx3QDrAShOpDoFi/+9uNqGZ9URys9JJDrLiXCP3x/hZ2l96E3sc2RjpQk2nXk1W4xrxXlvDmowJVBLNfxOgAdQEjckZwAUpIPJas+wF+Ad0w8DxCP5IC9/KkSTpmBAnT9iEUSe7gH5xOW7qWTYr8mTqhbdBR17AkEw== Received: from ME0P300MB0414.AUSP300.PROD.OUTLOOK.COM (2603:10c6:220:22c::5) by SY8P300MB0423.AUSP300.PROD.OUTLOOK.COM (2603:10c6:10:298::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 10:37:12 +0000 Received: from ME0P300MB0414.AUSP300.PROD.OUTLOOK.COM ([fe80::b8f3:cb85:3e65:5cde]) by ME0P300MB0414.AUSP300.PROD.OUTLOOK.COM ([fe80::b8f3:cb85:3e65:5cde%4]) with mapi id 15.20.8093.027; Thu, 31 Oct 2024 10:37:12 +0000 From: =?utf-8?b?6KejIOWSj+aihQ==?= To: "linux-mm@kvack.org" , Jingxiang Zeng CC: "akpm@linux-foundation.org" , "kasong@tencent.com" , "linux-kernel@vger.kernel.org" , "tjmercier@google.com" , "weixugc@google.com" , "yuzhao@google.com" , "chrisl@kernel.org" Subject: =?utf-8?q?=E5=9B=9E=E5=A4=8D=3A_=5BPATCH_v6=5D_mm/vmscan=3A_wake_up?= =?utf-8?q?_flushers_conditionally_to_avoid_cgroup__OOM?= Thread-Topic: [PATCH v6] mm/vmscan: wake up flushers conditionally to avoid cgroup OOM Thread-Index: AQHbJ55Kce2Bdaj+/EWCOy8iooPhUbKgsIiY Date: Thu, 31 Oct 2024 10:37:12 +0000 Message-ID: References: <20241026115714.1437435-1-jingxiangzeng.cas@gmail.com> In-Reply-To: <20241026115714.1437435-1-jingxiangzeng.cas@gmail.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: ME0P300MB0414:EE_|SY8P300MB0423:EE_ x-ms-office365-filtering-correlation-id: 4afcd56e-a68d-4674-6aec-08dcf997fabc x-microsoft-antispam: BCL:0;ARA:14566002|7092599003|15080799006|8060799006|19110799003|461199028|15030799003|8062599003|1602099012|10035399004|102099032|440099028|3412199025|4302099013; x-microsoft-antispam-message-info: =?utf-8?q?B7iJdvaWbSC4/lttUO5Sh5zfTP4J0T4?= =?utf-8?q?oEdn9Lj6oRby0NyAx03JZEcnXy+Vau/64Qk6anzvl+FURQVCo3uJO/m/6hzG4+73s?= =?utf-8?q?mv9Q27GPf8s3Lz85+38/n68FImbAKkZl55SO3xF2HRudqqxUPknfX1QbJ3c/AibQN?= =?utf-8?q?JfeEielaa64gIH8Aa8HGnGBtHlnANeSjGU1xZ4eOsAwuwiE70vhnYfSM4fVuM9l/1?= =?utf-8?q?dpcsSxJs5EzvmO6Hx0tmwCbtWmcFgSylwrpm37+mg8kkmEI6DE4d+hJ237WLHz1Pt?= =?utf-8?q?5tO7/6fpStfovx0Yda31HjYPm9P+l9HUXOmjzb8BFofn3ryY8WnoFhNQK6txHrYoa?= =?utf-8?q?S3IESY4UJA4Wu4YAEqOJfjWPnxq62HIPQpywYtxkI8aBEzGC0I+5eOUwPDISndvxH?= =?utf-8?q?MZXN8LwW3ykbMTzT8qVSYA8xuweotGS5XqLShN8Ic0TrvdIVZQzO+yUOIN26Lt248?= =?utf-8?q?ty82PgeS3DkQVGfYNy27vBY360FSiktBoAstWcQetPBBHcRN547+YxgPKMNSeCoOI?= =?utf-8?q?oUozu3W/zVw0rq1IC4zfdZl2/tjCYJ+nWdfHjZZ5VuRqptWjB5eL7Z4Yb+rZ8DAf6?= =?utf-8?q?VgZbsVL6DOgat4ZO5j0LWtkAV43M3JJersZW8f1DpdkZWuj5QnQFvb+Iyg0ibqFKM?= =?utf-8?q?JmkdRlSRoUk6LX62zp65SVxpvgXF0frMLrEJuDhHwPZpRjmtQKkRMAxm9BbgH+iVX?= =?utf-8?q?3qhTrFEydBaniRhDRjo2Mc6oiqnu7i27cVqG2xct/fpGcv1W2SNxLcbzN4iKToke4?= =?utf-8?q?fpk9py6ThtlpXkgwfd87hDkD7ZXGLExebPgvu2s0GEXbfeRDhQHe3jL/sI+hVwtwT?= =?utf-8?q?Y/MZLRGFlvtnFihJOau+cCRozl92IJFezyJ0BZbTNodkAtRWHrslVhgpw9rBE106R?= =?utf-8?q?1krO/MfAfp8KCxnmLkau8QhNWoQSZui8GGnpMIFgLc0OEYubv5MzrA0p+vMqu9glM?= =?utf-8?q?SMCLsOp9UAHuMv/n2dUV6ssFby4MMj/Jl9pTMZrrGLHiZv1df7cFCuwh0faEVtrtK?= =?utf-8?q?8MEiwJ1Oip2+9GcZRKtjPK81732xbnyuZ3CXMANyCzNMwf2w2j4iF8qsHg39qNihC?= =?utf-8?q?VTLtt4jV2jfKCeITSzddOP6MvNMgCyW/tysmXYYHXsbdM4XvKScyFvp4YwDWYRNuM?= =?utf-8?q?lm8WlOm0c9nB2hPtCUjUmUcI1lERGesvA4lPrNIZS2Hb1lwkF9TGNIedWHcCkVBNT?= =?utf-8?q?QtW4Jsvs58Ec5a?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?f4Ohh1gLqSGJSI14eIpwDdqlK+ZJ?= =?utf-8?q?1Ik3I8LBsIOj4EQcSolj5zy7jDPNkbGOmA5WxejBZ3MkhUw0j3Qt6gjJ/DdK99xg8?= =?utf-8?q?TLP71l3ZMMqKyd7TFThvakuLvJMx/3tJ1J++QN56IOov36G+nqDHKLWIdt1hgVfNC?= =?utf-8?q?Qj2c1yggbENjHZTWcYXwLomAzTiLyprIoe7DG6JgmyOq0QoktdN76nGAKqkl5Dm9s?= =?utf-8?q?IVkBVuH3uHaJvGYTXJE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7kvAB19XQJzcoyWq4/6XjJ0DLdKQ0VkSQND4MOa2?= =?utf-8?q?u+pd4TXCC9JP/gbuAiqnmtKkrLUVFICXIw24TLV66HOU8u5JNZXozQ483PjXNOIlr?= =?utf-8?q?2hxv7qVz38eLobqzVqK87WhsCfB8VPbjnSOVP42RhUkG9gU0qcm7ZOAqjB/s=3D?= MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-448bf.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: ME0P300MB0414.AUSP300.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 4afcd56e-a68d-4674-6aec-08dcf997fabc X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Oct 2024 10:37:12.1193 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SY8P300MB0423 X-Stat-Signature: oek51b1exkdz65ami56ouaj6j97sz73d X-Rspam-User: X-Rspamd-Queue-Id: 4A677A0005 X-Rspamd-Server: rspam02 X-HE-Tag: 1730371018-510760 X-HE-Meta: U2FsdGVkX1+3UfG+b+QYedslavM2HfH4A+NYwf7ea0wlqBc1dKdiKOpg2AKeWWswxXpUuiu6TdctmaSAJeSUrahugwFLUaEguXx65UHI6x3Wu8qRmwAwMMhLCxOK1DcL39fGFR6nqj7o0ZbBuPEsmuRTYQRI7m9YmRmjUXl65IioqnHla1R33G2/J5t6d4hNhXMAv1MDuVNjld50COrHOXRM43pE6WiRAX/95dW8DnCsLtEFGg8h6LLgELTkyB47kB3e4HSlbiLgm5m1U2IyNNsDttvTza0Wib5y2vPuwGsw8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x7vexaQPeKWrZXHoXCS2t4Q9mnfmI3hfmTaweLKN0D6iYsaAoxR/zv/4bo+3S7P3pBpVToQbzDt0TwZroxjd2Pd8jLP3kgjHDUex8+PhRXAjXj8H0+sOragdUdgyBgq1kIXhrELmaWbmmyz55qjs9tMe3HFI/5yo1OriHr2b6bA2eMvToxLqCgHacOQ6fW0d1ImWoELP0U8pt2YdjRI35D1nd5v0P/KUNegw+AoRGhiPcDlMESLq+N3fWJwmo7+MsTm9C9Pw3e+FKwPVNPdGfQUT+Qz3/nc6lc= 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: List-Subscribe: List-Unsubscribe: Hi, Jingxiang, if (type == LRU_GEN_FILE && dirty) ==>   if (type == LRU_GEN_FILE && (dirty || writeback)) Since, writeback is set when flusher starts to work on it and clear dirty flag. Best Regards, Yongmei. @@ -4327,9 +4328,17 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c                  return true;          }   +       dirty = folio_test_dirty(folio); +       writeback = folio_test_writeback(folio); +       if (type == LRU_GEN_FILE && dirty) { +               sc->nr.file_taken += delta; +               if (!writeback) +                       sc->nr.unqueued_dirty += delta; +       } + diff --git a/mm/vmscan.c b/mm/vmscan.c index 084de0efe59b..794730c8c1de 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4282,6 +4282,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c                         int tier_idx)  {          bool success; +       bool dirty, writeback;          int gen = folio_lru_gen(folio);          int type = folio_is_file_lru(folio);          int zone = folio_zonenum(folio); @@ -4327,9 +4328,17 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c                  return true;          }   +       dirty = folio_test_dirty(folio); +       writeback = folio_test_writeback(folio); +       if (type == LRU_GEN_FILE && dirty) { +               sc->nr.file_taken += delta; +               if (!writeback) +                       sc->nr.unqueued_dirty += delta; +       } +          /* waiting for writeback */ -       if (folio_test_locked(folio) || folio_test_writeback(folio) || -           (type == LRU_GEN_FILE && folio_test_dirty(folio))) { +       if (folio_test_locked(folio) || writeback || +           (type == LRU_GEN_FILE && dirty)) {                  gen = folio_inc_gen(lruvec, folio, true);                  list_move(&folio->lru, &lrugen->folios[gen][type][zone]);                  return true; @@ -4445,7 +4454,8 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc,          trace_mm_vmscan_lru_isolate(sc->reclaim_idx, sc->order, MAX_LRU_BATCH,                                  scanned, skipped, isolated,                                  type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON); - +       if (type == LRU_GEN_FILE) +               sc->nr.file_taken += isolated;          /*           * There might not be eligible folios due to reclaim_idx. Check the           * remaining to prevent livelock if it's not making progress. @@ -4579,6 +4589,7 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap                  return scanned;  retry:          reclaimed = shrink_folio_list(&list, pgdat, sc, &stat, false); +       sc->nr.unqueued_dirty += stat.nr_unqueued_dirty;          sc->nr_reclaimed += reclaimed;          trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id,                          scanned, reclaimed, &stat, sc->priority, @@ -4787,6 +4798,13 @@ static bool try_to_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)                  cond_resched();          }   +       /* +        * If too many file cache in the coldest generation can't be evicted +        * due to being dirty, wake up the flusher. +        */ +       if (sc->nr.unqueued_dirty && sc->nr.unqueued_dirty == sc->nr.file_taken) +               wakeup_flusher_threads(WB_REASON_VMSCAN); +          /* whether this lruvec should be rotated */          return nr_to_scan < 0;  } @@ -5932,6 +5950,7 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc)          bool reclaimable = false;            if (lru_gen_enabled() && root_reclaim(sc)) { +               memset(&sc->nr, 0, sizeof(sc->nr));                  lru_gen_shrink_node(pgdat, sc);                  return;          }