Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1466849rdb; Mon, 19 Feb 2024 17:45:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWqocvVvwKYXYJalyfnn0vNJkpz0co+jojc5w/DFJHtaraG9ybDjvda9wwIkNniYh1DMFPKjIfDmAJnQ9iayeA5fh001bWgIZnIZiXIcQ== X-Google-Smtp-Source: AGHT+IE8jLruASfd/i+F2/dZ5z55Xki+k9w5iODO/pURtZyCSmOjWSnuMQGOedv0OXd7zcPcgT/C X-Received: by 2002:a0c:c990:0:b0:68f:5c6a:172e with SMTP id b16-20020a0cc990000000b0068f5c6a172emr7151057qvk.48.1708393517094; Mon, 19 Feb 2024 17:45:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708393517; cv=pass; d=google.com; s=arc-20160816; b=XITdw5UIH7RHXtbg5Xktevc9QAqoJUayq6N6Dnn+q7gJteKFHnbeHYGqtqIsQRXKq/ ndbnGfSs2ZodQHdgjyXNVzlhZnuAT1cmUww7HFjfiwUv4y3zIfc80suRpcziRW82i+Op tOXQv7w1dDdz3rb5aeHL19lpf35q5IhvrKbEx0tkNe2nBCp3boJSsVQkJDJ6lWhAyHAY mD91XKrcrFN28VFxNsLXOEkb6dzFrUVcdiWj9ChjsY/EkK0byaNxD2EhTEbndLqrUb0a AneNP6ySDA0Cod3mnmKre5Y7yaehvu+oZ+EtZvtJaALSVBR8Fwb35Ctz+PRF2Qk+ejkQ pk8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=DK7VzLh3fXi9GAIr/c52j9BKfe1KvD0y/Txf450+Cf0=; fh=sQKziTrDqjMLluRMcZwQOl5k4zBGDIoYVkbSfBK8AVU=; b=OqFdwVq1Fj4rjZutGiSsEV7LTUe0WVlD1B+L0sFh3ogneE/2kLQ84NkcbIz+BTz3N0 fAFtW3RFXfeWjq+IneKsgXB0Km9GctVIOblGVHVjBhNBPQ58xaSiybEaflN3RJBAA2z0 xDtpCuX3ybSfnMQ3b5+5FiYlnUCLY4IqMeS739/dVu71+ldoCOdQQwDbQDwAjMebLb2p vUofuq1B+FtmsUFWRB6GSwKvodKSPgal1jSEvETIoeihyWdGTKuj3HnZ2B5uwl5s58PH o3Bck8pMBQcShhWHugEs4BEUyxOv4B29IMYj4pv6mwwgUQyhxoWaRqOMFlqHLlhp5MUi ycwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=hxR8vxdP; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-72189-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72189-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t5-20020ad45bc5000000b0068c3d2d61f1si7496173qvt.120.2024.02.19.17.45.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 17:45:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72189-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=hxR8vxdP; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-72189-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72189-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 8D0A71C225F9 for ; Tue, 20 Feb 2024 01:45:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AC3A56B69; Tue, 20 Feb 2024 01:45:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="hxR8vxdP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1907C5674F for ; Tue, 20 Feb 2024 01:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708393510; cv=none; b=omltKYCgxOWKsa7t+0bxcXBu8G/S0ELD8P8szx7qU0YE1x8QkJzCkxNCbjjzbsfXLs2LLW210FbnX7Dn5L8eBwolRfD2YJAsasqDB9gtTLqZShtNcU9ByjpqkBKgL2MQag7wwImWoLZuoN2M4w/PDTGjt21KiEnAxw2G3y2ozgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708393510; c=relaxed/simple; bh=bH5h5ony5qUQ486pdiFhGnBGdeuVTtKFvRLLq+v8VYI=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=MnYPdw39hNYzG+0KJmzDKTUFfxuBlXM77oJSWT1ZLOFJJaJWJG4vWABFzT2z7FXLn73nDf38mBJcEUhm1OrYyZ+nwhrIgviveqMIzoRqffej5EoNoCfdC0Tbx7B7ka7PZ3+tDWUUK34sU+jb8Ix7t6vH3qMOqjh1Ih4AmcXzTJA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=hxR8vxdP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F097AC433F1; Tue, 20 Feb 2024 01:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1708393509; bh=bH5h5ony5qUQ486pdiFhGnBGdeuVTtKFvRLLq+v8VYI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hxR8vxdPW00n/OfLARc9/pKeR04gPBW96rZWwFbk2PzH0AhVwwSkqjVLakNemn0B5 9mBkpGKCsQvT1SPUYLnNk0HgfuzTsfB2Sv/oS51qMcX3D8fCbxkx+jDrH/vWHqLS97 QZNfNJ8+FXT1hwSnO3INDXKuGAAb6E7/OdrycdQA= Date: Mon, 19 Feb 2024 17:45:08 -0800 From: Andrew Morton To: "Huang, Ying" Cc: Byungchul Park , 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: <20240219174508.bc6256248a163c3ab9a58369@linux-foundation.org> In-Reply-To: <87o7ccrghz.fsf@yhuang6-desk2.ccr.corp.intel.com> References: <20240219041920.1183-1-byungchul@sk.com> <87o7ccrghz.fsf@yhuang6-desk2.ccr.corp.intel.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit 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. 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. */ _