From mboxrd@z Thu Jan 1 00:00:00 1970 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 4BB92C2BD09 for ; Mon, 24 Jun 2024 18:54:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD6916B0386; Mon, 24 Jun 2024 14:54:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A85CD6B0388; Mon, 24 Jun 2024 14:54:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94DB16B0389; Mon, 24 Jun 2024 14:54:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 756796B0386 for ; Mon, 24 Jun 2024 14:54:31 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id ED6C3161142 for ; Mon, 24 Jun 2024 18:54:30 +0000 (UTC) X-FDA: 82266683100.04.6FE9D9A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP id 1C8C84001C for ; Mon, 24 Jun 2024 18:54:28 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=d87c12vY; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719255256; 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=TzlUaFbysJxYqg4lFli1LHYXJm8gggtlo9u9TQd/iss=; b=2r8KcsdG7XmBqJgyNe8xytvfjZSD3xCtfLtJ2+tugXQHu/15ojOy4K/brBvD1PlSnyURBc 8pYXPwTxsTR2oqcx07EbwYfiHzArzD0XfdZS7C7lGohwxhwalZHtQKUIEwOi0bvwdXfwv8 wYraMaaU5sRN4k93MT8H+uO0GT3zJJI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719255256; a=rsa-sha256; cv=none; b=zw7iSxZkEH84Bxm0L3+d8N9yi8cYXUnp/uvlYqgB5eIAO04FFMozU9GB21ve5O/7mVdC4X +tlS07qw58NzQNLCe359tAkz0L5hAibolBEBV5dojNGU27Fbs8UOlT1vFVTBL+od4e/jvo htbjYlv3MK+Sw1b+AUYl78oBasDE1x8= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=d87c12vY; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=TzlUaFbysJxYqg4lFli1LHYXJm8gggtlo9u9TQd/iss=; b=d87c12vYIxHPF1bPYLUMuXQ9S3 wGlIDoB6w7W/hQ0e0piEKYxV1DvlIKBOW7JXbzODG4ngYSGGs0aBNncD5H+9Pp4WqB5pgx7pBN3DD WZau1vtBf5PCWYKRor3THVohr1nYxdjqu7m0cOfYehZlWOGg9FvaMhWxpVkeBG/UscBVBM5TRsJ6X P1y3Ls2Hqt9mOBlRkEMe12OlaKyCIQd2cUDjFsUoQ1pn/MHfwfCt8GWQ9Pj+UpR4DpJxYJc0+nNxu xZA4BouKSI4Icz5gRFCgBPUtDEZcG63qagW6OSn22FHshH1Cu5Zh2wQ9k8QB7nGWcygRLvYIZ16nZ Wsylqf8A==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLopc-0000000ALXV-1LNO; Mon, 24 Jun 2024 18:54:24 +0000 Date: Mon, 24 Jun 2024 19:54:24 +0100 From: Matthew Wilcox To: Usama Arif Cc: Yosry Ahmed , kernel test robot , oe-lkp@lists.linux.dev, lkp@intel.com, Linux Memory Management List , Andrew Morton , Chengming Zhou , Nhat Pham , David Hildenbrand , "Huang, Ying" , Hugh Dickins , Johannes Weiner , Shakeel Butt , Andi Kleen , linux-kernel@vger.kernel.org Subject: Re: [linux-next:master] [mm] 0fa2857d23: WARNING:at_mm/page_alloc.c:#__alloc_pages_noprof Message-ID: References: <202406241651.963e3e78-oliver.sang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 1C8C84001C X-Stat-Signature: 5xjckt97ghdpoo71kgdtbpe7o9x67czq X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1719255268-463850 X-HE-Meta: U2FsdGVkX18pOOBv5muO2oQ55dC3hOaZ1UyMnA4mWd0E+eiiz1oL9D3cxu3oP2/lYRUp12HBhZToApgT1VaNoSi7xoSqCaufJW3PzFCOPEhG0M3/Q+F++OwTf+2B97LEBEFeoyHjIrvy03IdWEI4mFMJz1hyNao+KyxVnPCyxxPPMXuEmG5Hv/GDxIQG0iHpRzr7MropYMS+BKQKGBB9LSAIElC3FYekHFL89D+rFN78uEebY6kDvkM76ivNHly8e9CAQyCAXvIlw1p7vj6wv/IMqYmVkVn1dgmzMaxKUXec8yALEXijAN3VlWwGyJlEWpymTXJb9/M98d2ws8tkpVoAMxQgCqie5w1QGDNsAJKjiDoZKPc/qevlBegwOfuEEHpjl274OjOxYjBUEOrXIzTSp4wvfPd/wxrn5wvhNBFZhcwe6TeXP/X3F91U4WKO0dijOyQpzoUGKAdlD7QU0GTkWLccGmYUixgx0DoqREfvii7CcdO1iEjeRwwZJ16pCFVCzV/kTMF63Zz1js6OUU8cytfklkHCB6aQLSNGODBCQ9jAdBUbPecZXOYQ0kDFvH+JA+wSIoi3DStc58V0MgUusQX92S3lDGTUwkB6YMGScuHcmMx9x0xHb98JjocF6+1T3eyKDWPaQaWT/btIKCWtI9vM2gbVsS9cZe4q0dKRSe7w3ymGohgTY0cD5f1Y8c+DvJvAoSHg2r9w+9qVaY/cYqYbRiiZcqe5R5gnzQuNW3Fdy9ymUN3SpYm3xh8wlnz+z66j2BINndsLzX4C8j0uelTc5gVc1Xwk1EiUGftiy1Sg+5R+dPt04qrWGV5kzJLR8m/wMLmItE+CsGmC16vr+yMOlaXXj4MOFGuYNkpwo5uiY2pI6uCAdMinnlyX96Rn/Q/HXw1LPtPJSMlsHdLOjoBt1kjPTgJTZLm8nQKbTBAY3tzCDosUFmf+4PVccmzXkke1WRxRA4KLYqM 2juDUaXe AeRfUCBxGlgHQ+UWZM0F+D4hd+8DK8qp/5mfwB80yJ4d0mT1WIREeeLHRoArXIECd9OaLsmQiLNas1muzgat3og+1rU6xLF98TXs191+45UdsBOCe8s1VV35vkAfG264b5uklnqTjD2YUM2DMEF4WYEAhPA+oAQCQ6jHkAkmNsL5MbCwv7KyxfRhcsk1vqDHsmplApTrJ9VQejCxvVoyy/1kLkCdY6m+y5QPafWzVCE3xMnxnRJZnZAMUqFcULMkkywjfTsrz595+eEBdBcLkh8K5u/LQNo7BEpgna6krL6i8wcKVRtaL8Cfd3u0+XV6pbPYnaqFhEm2xrkfYnBp8W4zeYLIfrmeUDfejTcRjufjWULI= 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: On Mon, Jun 24, 2024 at 09:50:21PM +0300, Usama Arif wrote: > On 24/06/2024 21:33, Matthew Wilcox wrote: > > On Mon, Jun 24, 2024 at 05:05:56AM -0700, Yosry Ahmed wrote: > > > On Mon, Jun 24, 2024 at 1:49 AM kernel test robot wrote: > > > > kernel test robot noticed "WARNING:at_mm/page_alloc.c:#__alloc_pages_noprof" on: > > > > > > > > commit: 0fa2857d23aa170e5e28d13c467b303b0065aad8 ("mm: store zero pages to be swapped out in a bitmap") > > > > https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master > > > This is coming from WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER, gfp), and > > > is triggered by the new bitmap_zalloc() call in the swapon path. For a > > > sufficiently large swapfile, bitmap_zalloc() (which uses kmalloc() > > > under the hood) cannot be used to allocate the bitmap. > > Do we need to use a bitmap? > > > > We could place a special entry in the swapcache instead (there's > > XA_ZERO_ENTRY already defined, and if we need a different entry that's > > not XA_ZERO_ENTRY, there's room for a few hundred more special entries). > > I was going for the most space-efficient and simplest data structure, which > is bitmap. I believe xarray is either pointer or integer between 0 and > LONG_MAX? We could convert the individual bits into integer and store them, > and have another function to extract the integer stored in xarray to a bit, > but I think thats basically a separate bitmap_xarray API (which would > probably take more space than a traditional bitmap API, and I dont want to > make this series dependent on something like that), so I would prefer to use > bitmap. But we already _have_ an xarray. Instead of storing a swap entry in it, we could store an XA_ZERO_ENTRY. If there are long runs of zero pages, then this may not be the best idea. But then a bitmap isn't the best data structure for long runs either.