Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp583963rdb; Thu, 15 Feb 2024 08:59:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVpHzCe6abFkBZEqXTADoiXlIvqnz2HQScyXTGwDMFqNmDmqBsAD8Kcix/piGt3ykxXHTGQ+wWWTZES2DfuLWWzpXy+sJX7X2wm/GhvOw== X-Google-Smtp-Source: AGHT+IGmv4W/8unLKir1mtFVad1wDoelqbF0QsKwyWoGkDzRbn26u3RWEPcaSp30seKHfWsfWWXM X-Received: by 2002:a17:906:855:b0:a3c:d5b2:f53 with SMTP id f21-20020a170906085500b00a3cd5b20f53mr1506323ejd.15.1708016342079; Thu, 15 Feb 2024 08:59:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708016342; cv=pass; d=google.com; s=arc-20160816; b=SNVhHREjdTqKKza+PNOEKg2r2leo3tZj4sg3BDZa+yAU47TerPBIX5Fe7THbaXj9VC 0oYTcLKMNhiKOijQ5w/lrU0AGgdSSA50PiwgbnYs7+22Q86Mt0S3N9Snx0o21wWxW7Yt Ebj85xuTkeg5cvqbYhy5ubENZgrPNvNAAfyTwUl+hsE08nfNsBAyk+CMQTLU42NFVO4q s7Mby16i570hgblrWtTPXgOpTVhYLkd3djz0f32KB7/KmlIJCMZkAjba5doROMxoWAFw jEiYa0yNwa99AeDZwqH3mQYv7aftxwEWn3VhLEOX6Xy5/2XAzCOk+ESdZpbuiLrEs2yi mgpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=l7muDhr8z81X6jCxdMQftsbeBEUefCO81St+FLzSeTk=; fh=9AM+AKsITw8Ffv63vBRldTpcD0m6KYMf20ozCQ3u5pA=; b=BntRtq1LWQftB7uVgTiKwgFvDOtHaUTCq9meGqkwEXgoeMGEgwfqzF0NUivSW3LrD3 AC2w5pi0vrFZpY9Aj5nM9lkXT5+7iiXCKte0mKQrnrogUa5LNJjAFiTM5xPnz4pTOsJD f4l+7NGGoJNfj9exgP6+Apq0BYaDcZ/uRM+F0Mr+ISOdtfNtqiH+Y1Bb29bqk+qcSiOe rWDoTRJj1DmUUt5yfW0d+JG54U2/kZW3vCfo6bzChzHDRBPUr1a59NMJiGSL1vBXtm2e kTwgb0mtrVUQbZPp5I3EUqzQgIjcNooWl5CzYLV+rUL57TEZKvL6YDJhSmG5c60MEz9V pkOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Uj78eShb; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Uj78eShb; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-67354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67354-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h23-20020a170906591700b00a3d0003c2bbsi757084ejq.1053.2024.02.15.08.59.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:59:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Uj78eShb; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Uj78eShb; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-67354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67354-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A757E1F22C1C for ; Thu, 15 Feb 2024 16:59:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56A9F136663; Thu, 15 Feb 2024 16:58:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="Uj78eShb"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="d4x9GOGa"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="Uj78eShb"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="d4x9GOGa" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 3E29E135A75 for ; Thu, 15 Feb 2024 16:58:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708016295; cv=none; b=YvXslKwb0UrpU7w7z6ygpouOyRdjDzujFM9E4GGQjPMHgF41KTLr2CnV2cOw7KTsKJFoGHMZ+7uMdKDxeYE7Dl98L0mdaIHYYFPxqlE/B7pIHQKTDqoEBTWd6n8Mh2Ds+pyxR0rK1PL0YYwF0vNY3GO4SzbRQHVoJrxZCG+FT+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708016295; c=relaxed/simple; bh=VkRUamCXaPtSJ6IdITg+zE5jNmLdwfb4psxszPgy344=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Gg/JD0oMTYVu0NIqM2C7H+5yk4+C4REpmy/Ji28xRawDtmauyvgTkERSug3hMcV39HN9esovmaOhU3Z1Mn/o3K8cmTihBpjFuGXKZgwgUbO6ch6QCYiVvt9OQH8GADgJ88Lztnlj/LP9DfvSJGc/S23jeMhQceUUih7ZnrAElN4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=Uj78eShb; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=d4x9GOGa; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=Uj78eShb; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=d4x9GOGa; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2AE982222A; Thu, 15 Feb 2024 16:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708016263; h=from:from:reply-to: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=l7muDhr8z81X6jCxdMQftsbeBEUefCO81St+FLzSeTk=; b=Uj78eShbmCGOVbMuA28C8iKzGylYbSaStAQ4dkI/AZ2eOXwjEledvo1aAoWlaAJI4y2yC3 7/GGEsczGzRkcT3MLZL4FPoXdvCMynBLLlkjTabgQznADQe+G2pITnpvd5dKe5THIpkhZb bYLdt6LpiRl9Sm9wsshAiKiEZcK2b5w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708016263; h=from:from:reply-to: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=l7muDhr8z81X6jCxdMQftsbeBEUefCO81St+FLzSeTk=; b=d4x9GOGaorsYebiZnthGeD3C+cEhXXfg4FLEm4KMXI1XDv1rTnwL6z7SHoE8wuucanmu7h WiFbeh0TCVvumJCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708016263; h=from:from:reply-to: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=l7muDhr8z81X6jCxdMQftsbeBEUefCO81St+FLzSeTk=; b=Uj78eShbmCGOVbMuA28C8iKzGylYbSaStAQ4dkI/AZ2eOXwjEledvo1aAoWlaAJI4y2yC3 7/GGEsczGzRkcT3MLZL4FPoXdvCMynBLLlkjTabgQznADQe+G2pITnpvd5dKe5THIpkhZb bYLdt6LpiRl9Sm9wsshAiKiEZcK2b5w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708016263; h=from:from:reply-to: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=l7muDhr8z81X6jCxdMQftsbeBEUefCO81St+FLzSeTk=; b=d4x9GOGaorsYebiZnthGeD3C+cEhXXfg4FLEm4KMXI1XDv1rTnwL6z7SHoE8wuucanmu7h WiFbeh0TCVvumJCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 01A1E13A53; Thu, 15 Feb 2024 16:57:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uF5gO4ZCzmX7DAAAD6G6ig (envelope-from ); Thu, 15 Feb 2024 16:57:42 +0000 Message-ID: <6a011e7f-4e21-4e31-a9a2-52cba3181337@suse.cz> Date: Thu, 15 Feb 2024 17:57:42 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 2/3] mm/compaction: add support for >0 order folio memory compaction. Content-Language: en-US To: Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Huang, Ying" , Ryan Roberts , Andrew Morton , "Matthew Wilcox (Oracle)" , David Hildenbrand , "Yin, Fengwei" , Yu Zhao , "Kirill A . Shutemov" , Johannes Weiner , Baolin Wang , Kemeng Shi , Mel Gorman , Rohan Puri , Mcgrof Chamberlain , Adam Manzanares , "Vishal Moola (Oracle)" References: <20240214220420.1229173-1-zi.yan@sent.com> <20240214220420.1229173-3-zi.yan@sent.com> From: Vlastimil Babka In-Reply-To: <20240214220420.1229173-3-zi.yan@sent.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [1.41 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_MATCH_FROM(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLqwhhqik4qyk5i1fk54co8f1o)]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; BAYES_HAM(-0.00)[17.29%]; RCPT_COUNT_TWELVE(0.00)[19]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[intel.com,arm.com,linux-foundation.org,infradead.org,redhat.com,google.com,linux.intel.com,cmpxchg.org,linux.alibaba.com,huaweicloud.com,techsingularity.net,gmail.com,kernel.org,samsung.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Level: * X-Spam-Score: 1.41 X-Spam-Flag: NO On 2/14/24 23:04, Zi Yan wrote: > @@ -1849,10 +1857,22 @@ static struct folio *compaction_alloc(struct folio *src, unsigned long data) > static void compaction_free(struct folio *dst, unsigned long data) > { > struct compact_control *cc = (struct compact_control *)data; > + int order = folio_order(dst); > + struct page *page = &dst->page; > + > + if (folio_put_testzero(dst)) { > + free_pages_prepare_fpi_none(page, order); > + > + INIT_LIST_HEAD(&dst->lru); (is this even needed? I think the state of first parameter of list_add() is never expected to be in particular state?) > > - list_add(&dst->lru, &cc->freepages); > - cc->nr_freepages++; > - cc->nr_migratepages += 1 << folio_order(dst); > + list_add(&dst->lru, &cc->freepages[order]); > + cc->nr_freepages += 1 << order; > + cc->nr_migratepages += 1 << order; Hm actually this increment of nr_migratepages should happen even if we lost the free page. > + } > + /* > + * someone else has referenced the page, we cannot take it back to our > + * free list. > + */ > }