Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1474725rdb; Mon, 19 Feb 2024 18:08:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWacOHZKUJAGQyCoJMIsgeFOkUieQf90nfAX4xc6g+qBgoNDWQ8/gZYxAcnYiTi8lp8z+I40+DUdKy46evh9ZAKlYjK5/w0REleWbXBHg== X-Google-Smtp-Source: AGHT+IHBSWheV9qDjZMOhuWHUN3n5T5kDRVvdXNqfQ37eab1vreg+zqRTqqTGy47h9/zsIJavtNd X-Received: by 2002:a05:620a:4013:b0:787:2851:e7ec with SMTP id h19-20020a05620a401300b007872851e7ecmr19823528qko.4.1708394895832; Mon, 19 Feb 2024 18:08:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708394895; cv=pass; d=google.com; s=arc-20160816; b=HIj0+KYBLZ4EfLzYU8tFSseL/TYx9FJZXcjGc1rz72vERRS7f7YL5rhoMyJqbYNzZm yFycIRM7mWK4DTRVMg0lIuk0ZeLjOwk4Xfp786g6DMlchI69YDwVwsYoX/OijbkIszcS 0tQQ6dKSlN/k4yhiPMTrRKmGnaYP6p7A2aeGHO3+sjgQjelNMZeb0V23ja2Nj/hWT4jr FOf53ta1rNIpAykfyLx/ohwwcgB5yJImW52bZVrXNnjFQR0ApKWqoNImWJxsV7bQvgHO M9ZEXF4YxHuJNrJIAzy/DxdU59/6O0hQhOLThcQuijoZrq0piTdt8sEjnYay4DPXAYVh naOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=A4yWuRegRJp/v8zZUHIaNDU3TdyDboGG3nf/FFjGR4w=; fh=WS1M33kEixEtFNXYNIC2GblsPDZ7EpPMBVRBI4r7EOM=; b=jGv3fMp3cn7r4Pb6QUekNu77buo4tieN4ecDqDAw4HCAZcruRKMXSoHrFcf18jbiFu ev4PtJGXFabA+Q+B+nnh71ktAK9xEFgbOK4Jtg0BkTy49Cuno8aJQmR2zAdAZeJqNBJs FV0NMcg9AFY7lAzHfXzP551IrkcZNZPTue0EZkF71jRI6goj1zRgbxwPpW6ZqnbXQt91 kSsJv8P5FmeS01pWk/6wceyM2ZISl8nUrH936qgiaV1VSl5WrCxixGv2/rRw+NwlxhWT xkDm5IPwBYqFxpXCY9SuzXANhkP8TdeoDzYaTkmfbpAQyJ/5Jkp7XRFfFB4Vvksbv4np Fi2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-72200-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72200-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 dw4-20020a05620a600400b007873a8dd491si8690495qkb.34.2024.02.19.18.08.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 18:08:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72200-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; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-72200-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72200-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 53A211C21846 for ; Tue, 20 Feb 2024 02:08:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EA853A8F8; Tue, 20 Feb 2024 02:08:08 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2E188465 for ; Tue, 20 Feb 2024 02:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708394887; cv=none; b=osvM6i4X9PzDq4OwVfbmfWNezAtAxVHLhc+liq5sCrBhV7Vzo9mWue8hTBJRd4E5ibPIcuEPLZkiJ73Aiz8aYX75oboFe47AxFoF0C4QT6MiNDuPISeUy44inCRl1LmtqP2rGGGUFm6Py3mRV0fZcToKXiR53lGhhTqd4bNVuTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708394887; c=relaxed/simple; bh=APJfew27VQ0v3mk16aVpKGackeZkEcMk0nMGzmDw30A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KYrh6N4r9GOEb46IMH+zZaax+79GtCjmt3Gqk2b0Cs+WVwVoLEGEFtyP3KcH8UQWq4WpMkZZp4jaBv0nwvNh7ZjAl2ZsyeufKXfPREhSmTCCU6S8h5yFozYS8YsgNYxZC9ZR1XywnhXu+DI/DGVUW/6cq6zooBZCPI7RpCv9Sq4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d6dff70000001748-96-65d40980b13f Date: Tue, 20 Feb 2024 11:07:55 +0900 From: Byungchul Park To: Andrew Morton Cc: "Huang, Ying" , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com Subject: Re: [PATCH v4] sched/numa, mm: do not try to migrate memory to memoryless nodes Message-ID: <20240220020755.GE65758@system.software.com> References: <20240219041920.1183-1-byungchul@sk.com> <87o7ccrghz.fsf@yhuang6-desk2.ccr.corp.intel.com> <20240219174508.bc6256248a163c3ab9a58369@linux-foundation.org> 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-Disposition: inline In-Reply-To: <20240219174508.bc6256248a163c3ab9a58369@linux-foundation.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKIsWRmVeSWpSXmKPExsXC9ZZnkW4D55VUg/M7tS3mrF/DZnHp8VU2 i+kvG1ksnk7Yymxxt38qi8XlXXPYLO6t+c9qMfndM0aLSwcWMFkc7z3AZLGv4wGTRceRb8wW W49+Z7c4OWsyiwOfx5p5axg9WvbdYvdYsKnUY/MKLY/Fe14yeWz6NInd4861PWweJ2b8ZvF4 v+8qm8fm09UenzfJBXBHcdmkpOZklqUW6dslcGUc+zmVvWC9RsXE5p/MDYwTFLsYOTkkBEwk bsz9zQJjNzROAbNZBFQlvs6dzgpiswmoS9y48ZMZxBYR0JVY9XwXmM0scJ1J4vq/QhBbWCBK YsaSL4wgNq+AhcS7b6fYuxi5OIQEVjJKXDyxlR0iIShxcuYTFohmLYkb/14ydTFyANnSEsv/ cYCEOQW8Jd6degc2X1RAWeLAtuNMIHM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zUyxdfp/1u2h1RGfj8f176tSWCapPvmATmXtcJ2RmjnyW KO9myU97K3y9lnP8/vkm74qV+4cGub+L17/95nng8Be/xSlVfJfyrnCer9jfJn/3X5NG2L+i +8HvH918Fen+imOWHPch0W/NtyTSvFOUWIozEg21mIuKEwE9GqczjwIAAA== X-CFilter-Loop: Reflected On Mon, Feb 19, 2024 at 05:45:08PM -0800, Andrew Morton wrote: > On Mon, 19 Feb 2024 16:43:36 +0800 "Huang, Ying" wrote: > > > > + /* > > > + * Cannot migrate to memoryless nodes. > > > + */ > > > + if (!node_state(dst_nid, N_MEMORY)) > > > + return false; > > > + > > > /* > > > * The pages in slow memory node should be migrated according > > > * to hot/cold instead of private/shared. > > > > Good catch! > > > > IIUC, you will use patch as fix to the issue in > > > > https://lore.kernel.org/lkml/20240216111502.79759-1-byungchul@sk.com/ > > > > If so, we need the Fixes: tag to make it land in -stable properly. > > Yes, this changelog is missing rather a lot of important information. > > I pulled together the below, please check. Plus, two guys gave the tags for the optimization patch as well: Reviewed-by: Davidlohr Bueso Acked-by: David Hildenbrand Byungchul > From: Byungchul Park > Subject: sched/numa, mm: do not try to migrate memory to memoryless nodes > Date: Mon, 19 Feb 2024 13:10:47 +0900 > > With numa balancing on, when a numa system is running where a numa node > doesn't have its local memory so it has no managed zones, the following > oops has been observed. It's because wakeup_kswapd() is called with a > wrong zone index, -1. Fixed it by checking the index before calling > wakeup_kswapd(). > > > BUG: unable to handle page fault for address: 00000000000033f3 > > #PF: supervisor read access in kernel mode > > #PF: error_code(0x0000) - not-present page > > PGD 0 P4D 0 > > Oops: 0000 [#1] PREEMPT SMP NOPTI > > CPU: 2 PID: 895 Comm: masim Not tainted 6.6.0-dirty #255 > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS > > rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 > > RIP: 0010:wakeup_kswapd (./linux/mm/vmscan.c:7812) > > Code: (omitted) > > RSP: 0000:ffffc90004257d58 EFLAGS: 00010286 > > RAX: ffffffffffffffff RBX: ffff88883fff0480 RCX: 0000000000000003 > > RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88883fff0480 > > RBP: ffffffffffffffff R08: ff0003ffffffffff R09: ffffffffffffffff > > R10: ffff888106c95540 R11: 0000000055555554 R12: 0000000000000003 > > R13: 0000000000000000 R14: 0000000000000000 R15: ffff88883fff0940 > > FS: 00007fc4b8124740(0000) GS:ffff888827c00000(0000) knlGS:0000000000000000 > > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > > CR2: 00000000000033f3 CR3: 000000026cc08004 CR4: 0000000000770ee0 > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > > PKRU: 55555554 > > Call Trace: > > > > ? __die > > ? page_fault_oops > > ? __pte_offset_map_lock > > ? exc_page_fault > > ? asm_exc_page_fault > > ? wakeup_kswapd > > migrate_misplaced_page > > __handle_mm_fault > > handle_mm_fault > > do_user_addr_fault > > exc_page_fault > > asm_exc_page_fault > > RIP: 0033:0x55b897ba0808 > > Code: (omitted) > > RSP: 002b:00007ffeefa821a0 EFLAGS: 00010287 > > RAX: 000055b89983acd0 RBX: 00007ffeefa823f8 RCX: 000055b89983acd0 > > RDX: 00007fc2f8122010 RSI: 0000000000020000 RDI: 000055b89983acd0 > > RBP: 00007ffeefa821a0 R08: 0000000000000037 R09: 0000000000000075 > > R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 > > R13: 00007ffeefa82410 R14: 000055b897ba5dd8 R15: 00007fc4b8340000 > > > > Fix this by avoiding any attempt to migrate memory to memoryless nodes. > > Link: https://lkml.kernel.org/r/20240219041920.1183-1-byungchul@sk.com > Link: https://lkml.kernel.org/r/20240216111502.79759-1-byungchul@sk.com > Fixes: c574bbe917036 ("NUMA balancing: optimize page placement for memory tiering system") > Signed-off-by: Byungchul Park > Reviewed-by: Oscar Salvador > Reviewed-by: "Huang, Ying" > Reviewed-by: Phil Auld > Cc: Benjamin Segall > Cc: Daniel Bristot de Oliveira > Cc: Dietmar Eggemann > Cc: Ingo Molnar > Cc: Juri Lelli > Cc: Mel Gorman > Cc: Peter Zijlstra > Cc: Steven Rostedt > Cc: Valentin Schneider > Cc: Vincent Guittot > Cc: > Signed-off-by: Andrew Morton > --- > > kernel/sched/fair.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > --- a/kernel/sched/fair.c~sched-numa-mm-do-not-try-to-migrate-memory-to-memoryless-nodes > +++ a/kernel/sched/fair.c > @@ -1831,6 +1831,12 @@ bool should_numa_migrate_memory(struct t > int last_cpupid, this_cpupid; > > /* > + * Cannot migrate to memoryless nodes. > + */ > + if (!node_state(dst_nid, N_MEMORY)) > + return false; > + > + /* > * The pages in slow memory node should be migrated according > * to hot/cold instead of private/shared. > */ > _