From patchwork Sun Sep 18 20:47:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12979589 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 BC9A7C6FA86 for ; Sun, 18 Sep 2022 20:48:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3369C94000D; Sun, 18 Sep 2022 16:48:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E736940008; Sun, 18 Sep 2022 16:48:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1614894000D; Sun, 18 Sep 2022 16:48:09 -0400 (EDT) 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 0667A940008 for ; Sun, 18 Sep 2022 16:48:09 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DCC301A021B for ; Sun, 18 Sep 2022 20:48:08 +0000 (UTC) X-FDA: 79926393456.14.4A564B4 Received: from mail-io1-f73.google.com (mail-io1-f73.google.com [209.85.166.73]) by imf14.hostedemail.com (Postfix) with ESMTP id 9692D100008 for ; Sun, 18 Sep 2022 20:48:08 +0000 (UTC) Received: by mail-io1-f73.google.com with SMTP id y1-20020a056602200100b006893cd97da9so13913174iod.1 for ; Sun, 18 Sep 2022 13:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date; bh=k+YWtvvaIypH46pOKiODFPRAWHrTFXoO8GcKmdHjqbk=; b=OlMG2YYSoaI4mZjuUmKIILmFBQzOnDlntGN26Om2dA9+EwzyWhX97ME2QjP4FF54Wq HcSym0iULyVcDBaU2cx2CdanghelI8OWweDwCogiLpqhjrPBg3H9piqlPZovPx9B0iCv 52bBOovYofIH7wCGf6K7eBN3tymCCD5V7lAvBFWCB7yzDJnTCoFdlukwqfX9fPdripCg P6NO83BFhBxtUiuahMHxOuRS55HLoV8lTlmOJVTQbpTDOYeJRhzlkaMyJOQlWHTzbDAS cOzq69Bjn+8Q8iNzV14aVV7vRz/WQ8Rhdu9uAzUk52ZlcRjJ2WE5IFCohHPs+DceuPOv f/8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=k+YWtvvaIypH46pOKiODFPRAWHrTFXoO8GcKmdHjqbk=; b=XwwVcYqD+ITa4Wkwmr9r8DSUV3bvKbvKvAtefIm1gxeWsxM+rKH/RN2Erccqs+APeo GJqHcKfR4VaSA3BRlOqeStbQLd4pPhwSuwpETC5TmO8PEwwOarkh++ACIvjzJx6JVy4e P9WzK5RXgHyiqDsHwUxXq4D65A7A99mOOfDjEERt2LXiTW4/mxp/swIQJ3jQGOGyj8vj Eo1FdfFqwoBt7889r+IFO1/buhBchI0sSSzjUEznHP3aOf1BmUVSkRUu7ES8P+7GznKC i8wZbFBU2+9R27mCzzBXJTsbcGDLicgnC/aNbWSi3pAcBUyrE6VtuJpme1CejWFn5a+p 0Eew== X-Gm-Message-State: ACrzQf3F7pif0/JJExKUmzR4LHCVjvc1WlBJw9ZU7LXXZZmf4Ll8l9kX +34XVA2197cozd/EULl6t/KV34CKXYM= X-Google-Smtp-Source: AMsMyM6S1PVX7RT1nMZd0WLX8Q7GYSpbx2WFMj/oICTcp1esFdFpsSG/YWX1wuL0PQMTWVzz34FUpFZvhtw= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:ccff:7b62:4ed6:2946]) (user=yuzhao job=sendgmr) by 2002:a5d:8a02:0:b0:6a2:250e:a800 with SMTP id w2-20020a5d8a02000000b006a2250ea800mr5958799iod.153.1663534088059; Sun, 18 Sep 2022 13:48:08 -0700 (PDT) Date: Sun, 18 Sep 2022 14:47:51 -0600 In-Reply-To: <20220918204755.3135720-1-yuzhao@google.com> Message-Id: <20220918204755.3135720-7-yuzhao@google.com> Mime-Version: 1.0 References: <20220918204755.3135720-1-yuzhao@google.com> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog Subject: [PATCH v14-fix 07/11] mm: multi-gen LRU: dial down MAX_LRU_BATCH From: Yu Zhao To: Andrew Morton Cc: linux-mm@kvack.org, Yu Zhao , David Rientjes ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663534088; a=rsa-sha256; cv=none; b=vvAFG6vNXJMx7lJB9Rsng/XUP3x5vzh18PKaIsFQcyZ9IC9J59mdHAW4Xg952KBrZiUb2k 5hKv9S6YNTH+c7jIjOJX8RcPNgKcsBnN7p+fwn8Ugy5uNEJdIP693/hxpNC/q5Ixgolcai 9UNGs+DIw2vXPpN1YoQz2N7jNklWXaM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=OlMG2YYS; spf=pass (imf14.hostedemail.com: domain of 3CIQnYwYKCM0HDI0t7z77z4x.v75416DG-553Etv3.7Az@flex--yuzhao.bounces.google.com designates 209.85.166.73 as permitted sender) smtp.mailfrom=3CIQnYwYKCM0HDI0t7z77z4x.v75416DG-553Etv3.7Az@flex--yuzhao.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663534088; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=k+YWtvvaIypH46pOKiODFPRAWHrTFXoO8GcKmdHjqbk=; b=s0Uovs0dKqdomnCI1MbhWSrydWMJt4Stbsoy5DePsnTeW8LLfPtv0Qn8apuctp+ONEBxBx FaWOc/7fVSfm2Lg1VZ+qk6nQMPJTkPBhgn+C8snbe7pE2JKKPmJ26bAhYW97ayNGy66aQN uXrgGt/ozKkD6IkmFgcMJeK9SQj+tPQ= X-Stat-Signature: 57uwyigb3tueiuq5pu646jb8r6egkg57 X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=OlMG2YYS; spf=pass (imf14.hostedemail.com: domain of 3CIQnYwYKCM0HDI0t7z77z4x.v75416DG-553Etv3.7Az@flex--yuzhao.bounces.google.com designates 209.85.166.73 as permitted sender) smtp.mailfrom=3CIQnYwYKCM0HDI0t7z77z4x.v75416DG-553Etv3.7Az@flex--yuzhao.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 9692D100008 X-HE-Tag: 1663534088-623454 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: A need_resched warning was reported and already fixed by adding a need_resched() check to walk_pud_range(). Dial down MAX_LRU_BATCH anyway in the interest of direct reclaim latency. WARNING: CPU: 22 PID: 2771 at kernel/sched/core.c:3637 scheduler_tick+0x339/0x410 Call Trace: update_process_times+0x7b/0x90 tick_sched_timer+0x82/0xd0 __run_hrtimer+0x81/0x200 hrtimer_interrupt+0x192/0x450 smp_apic_timer_interrupt+0xac/0x1d0 apic_timer_interrupt+0x88/0x90 RIP: 0010:walk_pte_range+0x1c2/0x6a0 walk_pmd_range+0x1ed/0x490 walk_pud_range+0xe6/0x2b0 __walk_page_range+0x111/0x690 walk_page_range+0x4e/0x150 walk_mm+0x110/0x200 try_to_inc_max_seq+0xdb/0xb10 lru_gen_run_cmd+0x153/0x1c0 lru_gen_run+0x150/0x210 stale_page_run+0x62/0x730 kthread+0x148/0x1b0 ret_from_fork+0x54/0x60 Reported-by: David Rientjes Signed-off-by: Yu Zhao --- include/linux/mmzone.h | 2 +- mm/vmscan.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 2b3f273faf68..4c8510f26b02 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -381,7 +381,7 @@ enum { }; #define MIN_LRU_BATCH BITS_PER_LONG -#define MAX_LRU_BATCH (MIN_LRU_BATCH * 128) +#define MAX_LRU_BATCH (MIN_LRU_BATCH * 64) /* whether to keep historical stats from evicted generations */ #ifdef CONFIG_LRU_GEN_STATS diff --git a/mm/vmscan.c b/mm/vmscan.c index 77d2d08950ba..2add99eecd0c 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4400,7 +4400,7 @@ static bool try_to_inc_max_seq(struct lruvec *lruvec, unsigned long max_seq, } while (mm); done: if (!success) { - if (sc->priority < DEF_PRIORITY - 2) + if (sc->priority <= DEF_PRIORITY - 2) wait_event_killable(lruvec->mm_state.wait, max_seq < READ_ONCE(lrugen->max_seq));