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 5118EC5475B for ; Fri, 8 Mar 2024 16:03:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BC7A6B0351; Fri, 8 Mar 2024 11:03:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 969256B0353; Fri, 8 Mar 2024 11:03:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80AD56B0355; Fri, 8 Mar 2024 11:03:32 -0500 (EST) 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 6DF046B0351 for ; Fri, 8 Mar 2024 11:03:32 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 15FC01407C3 for ; Fri, 8 Mar 2024 16:03:32 +0000 (UTC) X-FDA: 81874341864.14.9D71D19 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 7A2968002A for ; Fri, 8 Mar 2024 16:03:28 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=kSmT787D; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709913808; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zzh1zLamS7qD/mGgim39ZxKa7gZn5A8QcmH7nmOE5kE=; b=ntyg8hkPrseU5Hvnebub0yMFYODUVgGRCBulXdnCTeZ+21a3QvNtwUAOqfyo+SzV5Llj3m Kpa/E9oMl29Th41BO+6T1/WZE64ItnoQ4Dn/YSV09MaaCtWfs6sxkxENcQ+kK3XjiPL6zj m1YCB+5LJzR+PXYw02rI/HIaYQiXImY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=kSmT787D; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709913808; a=rsa-sha256; cv=none; b=Nht0IZ0HGD0AZpm0hQdi59qzY11063BHnfU/EpNAOKZGCfn+K87I2gRy+wwaa6yQYx1RTu iqrfoSgkEQfR9MPRZsKBHlibqP+YoHT53aWWM3InBmcVJwpYVpLlKNF1US0Mq2XmHZn2qx Re6QSUF8Autbgov3aPe1bvpLXns3Gvo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zzh1zLamS7qD/mGgim39ZxKa7gZn5A8QcmH7nmOE5kE=; b=kSmT787DZrKN+Qb8y216Dm3W7M RZKPUtXxPE/OIDaezSqviKjd+Sykzo1EfckENbBNmQ9hCnX4EpNm4LUa8+MPVjvbgajy1j1aUTAmj D7/M7vLBB/aw3c+lklvoZ+5V5xy9vfOPt78juMXJHPW1wzcWb98VYdgoHbn6TXHoIaGF5HabjGsQ+ g+YCn0nFa0RtB1O7dG8dljdvUCRICkdGE29yfGBMln336LllwcHFl7yqT012mcnvaKKh9jdFiTMFO q2AG7QwkNcjnYGPYTOSNApJlq7bOif1XIRwNxdv8Oao0wzR/PH13vWNhwWvfCPSZz3W/p1H0FKcs/ JispZrJg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ricgu-0000000Bp4f-1ZhA; Fri, 08 Mar 2024 16:03:24 +0000 Date: Fri, 8 Mar 2024 16:03:24 +0000 From: Matthew Wilcox To: Ryan Roberts Cc: Zi Yan , Andrew Morton , linux-mm@kvack.org, Yang Shi , Huang Ying Subject: Re: [PATCH v3 10/18] mm: Allow non-hugetlb large folios to be batch processed Message-ID: References: <36bdda72-2731-440e-ad15-39b845401f50@arm.com> <03CE3A00-917C-48CC-8E1C-6A98713C817C@nvidia.com> <7415b36c-b5d3-4655-92e1-b303104bf4a9@arm.com> <644c2f60-dbb0-4fdb-8505-96f8101b2399@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7A2968002A X-Stat-Signature: f6shxtikiopmhhwggpsaxid1etsmba4q X-HE-Tag: 1709913808-357668 X-HE-Meta: U2FsdGVkX1897ae2SPpe6KEkaQKJ/9yvUlaeTopc9wotqxpHUk7IMrw9rJhDk+sMzGHd0mNKZkjU8zUjI/E8qebuGZBiHqUFmi/CUiE0WpSLcZMtbHXeD5VL9jPD+QLx3umtK8nKN2LnPzIb6dK6+vc9sRKA6wOJ7rkfodQtd+jtZDtGhyZHFOMEVyzw3UN5Aw4vDzGDLC5ESYRyxOIi/ZfC4h4reOJhAsAFQdfJebBOLdBEdaLFNMEAAT8xIWE1ScmvtUduI8fKI/m6XZHYip4plYB57PVp/BEIhIjt91Ls72IvTzLA/NHd49QLE84lO0asuNFZDR3UuvaG6dpLi6bG1X9MTUro2PZ2BsP3M2Mo0xF1yhyulJOrIn26I7O7V28nhx+/y6AVd7POAwzasPUXd9iRUWY6VWpQhkKc8rQ2+k0viUSiRAdfKzCTsZkYlJqiD9niQrwi2l9htsN8N/B/8e1SPujrcXY06RY01kC/8dc5NhdlTu6p5whlIgvVWDwhCC+xvTveilc7vbB2rIJfvW4H39UeDz8ZG+cG22pGqk7svaSFmjH9iBgUbuyImswbO3RE9WjLuQbdXkQ0aDmIDleG4DvylOu0rx1WhbToSlPZ/Cv622NFjrD6nuyv8sv+aDAKyOmLvw79HiQ+2cREfjZCzUSNidnpgBWSCDEg/xQSn9EXOKy2hdhZ7E62Bfd2XiGVnEyyDwvK2vk1sau3/Fo1I/q2XVvhTbPt/YXd2vI/HbRdXKqB7KpsG2uiMg3ksntU3OpDNT4g1ZyiutnL8fB1ENJb5KBv+htm8WE0gLf0pFsCOjF8fkdQ9MMAidcpBKSia7/L/bnjEsNDvw== 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 Fri, Mar 08, 2024 at 03:11:35PM +0000, Matthew Wilcox wrote: > Actually, I have a clue! The third and fourth word have the same value. > That's indicative of an empty list_head. And if this were LRU, that would > be the second and third word. And the PFN is congruent to 2 modulo 4. > So this is the second tail page, and that's an empty deferred_list. > So how do we init a list_head after a folio gets freed? We should probably add this patch anyway, because why wouldn't we want to check this. Maybe it'll catch your offender? diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 025ad1a7df7b..fc9c7ca24c4c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1007,9 +1007,12 @@ static int free_tail_page_prepare(struct page *head_page, struct page *page) break; case 2: /* - * the second tail page: ->mapping is - * deferred_list.next -- ignore value. + * the second tail page: ->mapping is deferred_list.next */ + if (unlikely(!list_empty(&folio->_deferred_list))) { + bad_page(page, "still on deferred list"); + goto out; + } break; default: if (page->mapping != TAIL_MAPPING) { (thinking about it, this may not be right for all tail pages; will Slab stumble over this? It doesn't seem to stumble on _entire_mapcount, but then we always initialise _entire_mapcount for all compound pages and we don't initialise _deferred_list for slab ... gah)