Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp268992lqb; Tue, 4 Jun 2024 10:42:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5vg/ahdvVOIzLsHW6I7mpheJFPOSN9XXkbL/BbZZIKLgzj8sX7bCAxKgKdp/zmJBxzLEK1t1v0LzJYwn7FPXFO96zS3TL0DwBD4b1pA== X-Google-Smtp-Source: AGHT+IGhy/oOb2vAQal1sEygQrZ5Ox2mAAKbotxW6Fuh7VDZXNMken4dIjGXpc448Or1aST0dKZx X-Received: by 2002:a17:90a:be12:b0:2c0:238c:4ee6 with SMTP id 98e67ed59e1d1-2c27daf9c08mr168278a91.2.1717522968027; Tue, 04 Jun 2024 10:42:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717522968; cv=pass; d=google.com; s=arc-20160816; b=RFYkI45sB6O39V2cYxBJTYwXSEvSwuWY7VFr7wnB9puYNN1vcAfNzVfuU0xRCrXD/H FsZkCwu40d/ATGPccQqYK3zQv4pGm6cmgsp2yZsQI7m9ZEPHBhn2VTZAq8NHN/Na/VwY H3/9/k/rCe2/iDqhXI2kuQu9JoRn9K/NSVLLDwwAy8YLorht5PuZHrTPHvXh8Z6r/V7A s1U2z9IEnXAqO4nCXXAl5bOxUh/mCFzq8iNL4NZjVDtumwVPTZRjVv6eTKqsVPycLG8m RYoGfcimA4DG36geNIToE/qRaE8Px1nMXyzf66PF7+XdOBz6K4eFDd4Dh4TAPp/GlPLl SS5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=FSAsMIUgpkuY+akx1I0POUHLWSTt61sSZO6HEcvaGx0=; fh=zcr36QWRYhne0wR2Doq6dTzwNMobe+cjbBaaOTagJ6k=; b=Ml67AHWwEiGXNQXl1DIidjN4X5pu9WiEwlKzd3QeIzq6hVLO3D2sGOp+lsFYfelEyJ Vbg5R0vNWOwjLHYbqMJlr/gprpoO8UekqlZVwcDF9M30TCo+Ll0Y9EV2BTn6OiBNw/dc 7S4UvividMpvs8G4W1EiRbKlIf+2QH4L7LDnkfH2l/VYpLQMltLuuKMB3VEScmtBiglJ iSVwqBuVVD0DelIZiTCinR3WWD/1G+x2Sx5QHhWGTGaFgTfye3V1deiUF28MWxPmgO5A 03C7c0FjBTdgVeXSaZhdTxjBYacBl2jPoaUh1dK/Gki4IKtQmc2hox0N4rgrLZxnADPM khfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wTCzgzp8; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-201168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c279f616c8si532028a91.119.2024.06.04.10.42.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 10:42:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wTCzgzp8; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-201168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 010DE2894F4 for ; Tue, 4 Jun 2024 17:35:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C09F914A088; Tue, 4 Jun 2024 17:34:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wTCzgzp8" Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 286B81494CB for ; Tue, 4 Jun 2024 17:34:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717522489; cv=none; b=qdVjug02HRrnhwxU/1UusVmfTNEGPjaoOzcMbLjtqKh7Wr0wyDi2ZbLLWDFIBDzLN8GllPSvdEwX8U0NQNyZOtibS0m1CvfP6ci7C4kNQE9p7FrUzWlN0C+YtGDnjoY9884X7ivCiYtbGbHNd0jJEqjpvwvVEX0doShWCWyMDTI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717522489; c=relaxed/simple; bh=FSAsMIUgpkuY+akx1I0POUHLWSTt61sSZO6HEcvaGx0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ftkD4ldtJWvRZG7YHTt6rpQ2t4xZhD8K95reA80vQOTx0hI85w0ydTJoULLvlp87RptkWy7uLVvypj86o9V55bMYgppAW3gv4d05c6CMlHuOdiqZjSlhpZyF3tTqQtHxxF4t/AOXbVocftMI3KCMi7bhbzBoHWPkiYf/T6lPQRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wTCzgzp8; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-52961b77655so1415019e87.2 for ; Tue, 04 Jun 2024 10:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717522486; x=1718127286; darn=vger.kernel.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=FSAsMIUgpkuY+akx1I0POUHLWSTt61sSZO6HEcvaGx0=; b=wTCzgzp8h/jhyFFO3biznZkrkXsgLrAK9bnCLMpd4nyO2uCL8MKoMA+JSj50qRlAom MfkrjRP47vnOPfZ3D7J8MsuaNqffzMuwk6vxtLCW/QmEAarQhc4hfe62UmBQ/EVClDkF v2nw8kI8Isudnp98WWzNRlH+Sn2wqu8IBw5r0P8vYnJnmqoLxBPtarwFIEgwOFm2QrRw XGRGubfu1ZiRCqZ1A9r4zzct7n8ndRMQzs3EHTZomWmerIDZDH+d6YRw21QHNcWwNt4g mQXmlHDrz9QIEBgNVGneK9bnEkdb91y+qZPIFMVbl3zbjrdkF7CvYRceq+jCo4EVMsHZ TEFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717522486; x=1718127286; 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=FSAsMIUgpkuY+akx1I0POUHLWSTt61sSZO6HEcvaGx0=; b=pIDSbwX2dW6WGyQgqLSsTkRt6A66ajr/c8J+mdECUJNrfKLHyETwKfT1qeb/026GVL 2UOuawUbkJf4EFBADjhFrezBSluheXkQ0VO/BAWIgD0dZLAClHqE300ZQzzmK6XrHk1H tPNBhkgNN5YHfEUZtM4e/xilKlNat5l20s/xFlKBfosrV9HpdsX8fh1cjV83BL5EcN82 F2bqcTWDAnjBQO7oAtbsib4eizCHwkX9eob2CsQN3gaXMTiAM8tgA/c8p/9XGZj8waTD Edb6mKGt+36sArSfHftGZBodCOYcITz0GDsHuE34hfjHpMil8cIWyO2Gygy5awFSZ3Qk Istg== X-Forwarded-Encrypted: i=1; AJvYcCVolhYFzyk3w+szJtkx2Dj0LRT1bPXrZWHKfeDJVnfULHeJUBeadtbu+SfTyALGW8ORafl0j/sLEnp4qB8f3/HG34Jr1/JcB/tCfqR4 X-Gm-Message-State: AOJu0YzTta59dWBIuPFBpIvx/CTY4+5COxbU/mJS4gtQMwBDGuHPCUHd Vzxa0hDqR/yrtBlw5POPePvDVl8OyCNkBKoA2pZYEFT26Vh6h2Oq9qHxVUT/Jy36EhfxRxRFmBV kK48AUyYD83iOTg3w5A1joA3Upm1zKVR1dSIr X-Received: by 2002:a05:6512:3da3:b0:51f:5872:dd8c with SMTP id 2adb3069b0e04-52bab4e8a85mr148583e87.39.1717522486012; Tue, 04 Jun 2024 10:34:46 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240508202111.768b7a4d@yea> <20240515224524.1c8befbe@yea> <20240602200332.3e531ff1@yea> <20240604001304.5420284f@yea> <20240604134458.3ae4396a@yea> In-Reply-To: From: Yosry Ahmed Date: Tue, 4 Jun 2024 10:34:07 -0700 Message-ID: Subject: Re: kswapd0: page allocation failure: order:0, mode:0x820(GFP_ATOMIC), nodemask=(null),cpuset=/,mems_allowed=0 (Kernel v6.5.9, 32bit ppc) To: Yu Zhao Cc: Erhard Furtner , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Johannes Weiner , Nhat Pham , Chengming Zhou , Sergey Senozhatsky , Minchan Kim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 4, 2024 at 10:19=E2=80=AFAM Yu Zhao wrote: > > On Tue, Jun 4, 2024 at 10:12=E2=80=AFAM Yosry Ahmed wrote: > > > > On Tue, Jun 4, 2024 at 4:45=E2=80=AFAM Erhard Furtner wrote: > > > > > > On Mon, 3 Jun 2024 16:24:02 -0700 > > > Yosry Ahmed wrote: > > > > > > > Thanks for bisecting. Taking a look at the thread, it seems like yo= u > > > > have a very limited area of memory to allocate kernel memory from. = One > > > > possible reason why that commit can cause an issue is because we wi= ll > > > > have multiple instances of the zsmalloc slab caches 'zspage' and > > > > 'zs_handle', which may contribute to fragmentation in slab memory. > > > > > > > > Do you have /proc/slabinfo from a good and a bad run by any chance? > > > > > > > > Also, could you check if the attached patch helps? It makes sure th= at > > > > even when we use multiple zsmalloc zpools, we will use a single sla= b > > > > cache of each type. > > > > > > Thanks for looking into this! I got you 'cat /proc/slabinfo' from a g= ood HEAD, from a bad HEAD and from the bad HEAD + your patch applied. > > > > > > Good was 6be3601517d90b728095d70c14f3a04b9adcb166, bad was b8cf32dc6e= 8c75b712cbf638e0fd210101c22f17 which I got both from my bisect.log. I got t= he slabinfo shortly after boot and a 2nd time shortly before the OOM or the= kswapd0: page allocation failure happens. I terminated the workload (stres= s-ng --vm 2 --vm-bytes 1930M --verify -v) manually shortly before the 2 GiB= RAM exhausted and got the slabinfo then. > > > > > > The patch applied to git b8cf32dc6e8c75b712cbf638e0fd210101c22f17 unf= ortunately didn't make a difference, I got the kswapd0: page allocation fai= lure nevertheless. > > > > Thanks for trying this out. The patch reduces the amount of wasted > > memory due to the 'zs_handle' and 'zspage' caches by an order of > > magnitude, but it was a small number to begin with (~250K). > > > > I cannot think of other reasons why having multiple zsmalloc pools > > will end up using more memory in the 0.25GB zone that the kernel > > allocations can be made from. > > > > The number of zpools can be made configurable or determined at runtime > > by the size of the machine, but I don't want to do this without > > understanding the problem here first. Adding other zswap and zsmalloc > > folks in case they have any ideas. > > Hi Erhard, > > If it's not too much trouble, could you "grep nr_zspages /proc/vmstat" > on kernels before and after the bad commit? It'd be great if you could > run the grep command right before the OOM kills. > > The overall internal fragmentation of multiple zsmalloc pools might be > higher than a single one. I suspect this might be the cause. I thought about the internal fragmentation of pools, but zsmalloc should have access to highmem, and if I understand correctly the problem here is that we are running out of space in the DMA zone when making kernel allocations. Do you suspect zsmalloc is allocating memory from the DMA zone initially, even though it has access to highmem? > > Thank you.