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 574C6C2BD09 for ; Mon, 24 Jun 2024 20:39:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A145D6B0191; Mon, 24 Jun 2024 16:39:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9BF906B0194; Mon, 24 Jun 2024 16:39:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 812C26B0192; Mon, 24 Jun 2024 16:39:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 628976B0190 for ; Mon, 24 Jun 2024 16:39:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D2D941A1415 for ; Mon, 24 Jun 2024 20:39:55 +0000 (UTC) X-FDA: 82266948750.12.09B5E8E Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) by imf13.hostedemail.com (Postfix) with ESMTP id 375F820010 for ; Mon, 24 Jun 2024 20:39:52 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=r9vPtfN1; spf=pass (imf13.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.170 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719261586; a=rsa-sha256; cv=none; b=VtKWos+E4Ux7QkqRJo11cCn5xBJALOm+b1FdnR9s4LQMc5+Z79PBlgV7bDlTGXxbFRw7RR ioYfTjKCJ6JNjRLBAQjSse88MR45WAqiImt0o+DSWNQhvqKLAy28t7Y9H6LvvVHCiitHsR GnhzfVs96n6w8YKyMu4b4k7f/Ym403I= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=r9vPtfN1; spf=pass (imf13.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.170 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719261586; 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=hPba44UwS8OyBWu5/lBqHUuBuTA2f4k+/J3MHe31SZM=; b=A/GVEIU9aOL0CM/J8c5aK09a7Wxq+/apMKEhCz9M3O1NFyd+Ty5Kt1m4JwzKDOVimA///p UyVcptmZ7ysELH80/31dOY4Zmxa411vawDrZZ6h/E5o7V3ZE8ccntmJ3CXp49bH7aLfPYy uEGQfLmsPKR5pUeeRazppLM5EwqRRGY= X-Envelope-To: willy@infradead.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719261591; h=from:from: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; bh=hPba44UwS8OyBWu5/lBqHUuBuTA2f4k+/J3MHe31SZM=; b=r9vPtfN1YeKU5q1FAdT2nwJr9uMOxWd8YM/nobIsN/Km3ehDOchCvRs42c7sL6501EnqYv YC9qx3zou1ggrCwgQaydGwNHLa5MuSAQrmwJhMa502VEGuuoX8Gsh1YAj+dl6ru3pWw96R iyBL95NyzvEAjQqPgnyoUYnDH6tjgXk= X-Envelope-To: yosryahmed@google.com X-Envelope-To: oliver.sang@intel.com X-Envelope-To: usamaarif642@gmail.com X-Envelope-To: oe-lkp@lists.linux.dev X-Envelope-To: lkp@intel.com X-Envelope-To: linux-mm@kvack.org X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: chengming.zhou@linux.dev X-Envelope-To: nphamcs@gmail.com X-Envelope-To: david@redhat.com X-Envelope-To: ying.huang@intel.com X-Envelope-To: hughd@google.com X-Envelope-To: hannes@cmpxchg.org X-Envelope-To: ak@linux.intel.com X-Envelope-To: linux-kernel@vger.kernel.org Date: Mon, 24 Jun 2024 13:39:45 -0700 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Matthew Wilcox Cc: Yosry Ahmed , kernel test robot , Usama Arif , 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 , 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-Migadu-Flow: FLOW_OUT X-Stat-Signature: d7khprg8ocac3cib1mutngi56bcgr3nu X-Rspamd-Queue-Id: 375F820010 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719261592-956540 X-HE-Meta: U2FsdGVkX1/1XxhEvPx2+w4n5A/RsJbMAQRdbH2EULk427ntQudT8nm3Tl9+15JBtsFQ0dA0STZldiG8G3ib0ecAL7QrnPX6TG9W9ey7x9b6dE3JD9tSigrZspFLRVWgOyhPEaoEbatphes34WyBqix7Z6pE1f1nKA7cmv6cXHWeNgeRvW6mFoAsqufGZrC7ccYKUFkoAiSdo1ywiWBAVwV5EKgYuzWtZSlphyHlGYArU/uRpwdp76zlcEowG6GgjCI51J5qQ5bX175Ailj255l6sfFtANiEW8pjuSe+hAkplwSGxABPx8kjKgFkHtXGWkTfgGK8OWzTVKbAZoUsHoGAZqTnjGxmwYcpJKh6j2P79fxZrTRpRK2MdzwJnS2estmYCT+Ptl5ddIns6bYS2fFyr4zUq0ZLBSpYE5WPbn+YPR52jU6lmbSVVTdE5pxBy1UF2/TOYtqA1/+fXf5+sOm0Yj7CS/1tbjQsBTzxOkJTiYFGygvSwjQfKD12Fu5P7lvDPS66anQFdXzFr9jDyikvJgTUj/WloFmm22clqm+0SnFaeruUz9O3SlwjI4YqN2YAz/dtX8WV5zoWJjr7ey655L8jw7uUs3Z23q3uDQzlZyK7L7Xm0EhkWIjteHCzxm0mAhGZoaNxY8eYLBbCMAnjGWJEHKAw9mnejeK1YQK4pT/SxqHU8qSvtxVjOoEF3bXmmV7vIfJKEXsXQsXCWVOGfcN4BumZymEcRABcjqgep4WzRUC67mxBsCfqzPguFDrIHhE1Tw/ZlsAWq2vy+rnbg5wXrW0hMYECTLevokDx2VPNg30i6gOhholDXu6r2Uuq5PP06WP4izOihyVgMI0Nk1hdwXP8HjPM5F/C1ysc/fcEC3s4+QYOAdjFDomyweocvmAzTXuyIIQ+gekKdMdImhi/iyWLME3mrH0moKcsnfVCb+y4wEVpp8pp5VtX9h/LdbuAp2gflTE0Mjy NvE4dt4m NC2yNFZoBQMx4IFlC3PqJiGNN+mksZht/AcbulUqTbwNDsmR6okJfxTM6zNo4j5E80Q639zXgt8EolnHpAiK1iuHXP8jZdrkKepKdzT0NOoRTmKyDufB/aB+MEnf+NlOQcsfUtI3FWcbWlHJyHTJqy4x7Oa1rHRc2XOiVy+cADsaDxSHMOWRwA3J9fnZ61tr1eD5l6ET9ndrJXQMjBs395tbI2A/zrtQ14Aue1hshNNfROAJHAXekNgtTI3srlKgMaIWv 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 08:50:45PM GMT, Matthew Wilcox wrote: > On Mon, Jun 24, 2024 at 12:34:04PM -0700, Yosry Ahmed wrote: > > On Mon, Jun 24, 2024 at 12:26 PM Matthew Wilcox wrote: > > > > > > On Mon, Jun 24, 2024 at 11:57:45AM -0700, Yosry Ahmed wrote: > > > > On Mon, Jun 24, 2024 at 11:56 AM Matthew Wilcox wrote: > > > > > > > > > > On Mon, Jun 24, 2024 at 11:53:30AM -0700, Yosry Ahmed wrote: > > > > > > After a page is swapped out during reclaim, __remove_mapping() will > > > > > > call __delete_from_swap_cache() to replace the swap cache entry with a > > > > > > shadow entry (which is an xa_value). > > > > > > > > > > Special entries are disjoint from shadow entries. Shadow entries have > > > > > the last two bits as 01 or 11 (are congruent to 1 or 3 modulo 4). > > > > > Special entries have values below 4096 which end in 10 (are congruent > > > > > to 2 modulo 4). > > > > > > > > You are implying that we would no longer have a shadow entry for such > > > > zero folios, because we will be storing a special entry instead. > > > > Right? > > > > > > umm ... maybe I have a misunderstanding here. > > > > > > I'm saying that there wouldn't be a _swap_ entry here because the folio > > > wouldn't be stored anywhere on the swap device. But there could be a > > > _shadow_ entry. Although if the page is full of zeroes, it was probably > > > never referenced and doesn't really need a shadow entry. > > > > Is it possible to have a shadow entry AND a special entry (e.g. > > XA_ZERO_ENTRY) at the same index? This is what would be required to > > maintain the current behavior (assuming we really need the shadow > > entries for such zeroed folios). > > No, just like it's not possible to have a swap entry and a shadow entry > at the same location. You have to choose. But the zero entry is an > alternative to the swap entry, not the shadow entry. > > As I understand the swap cache, at the moment, you can have four > possible results from a lookup: > > - NULL > - a swap entry > - a shadow entry > - a folio > > Do I have that wrong? I don't think we have swap entry in the swapcache (underlying xarray). The swap entry is used as an index to find the folio or shadow entry.