Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1789095lqe; Mon, 8 Apr 2024 23:23:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/G5Q0nGM3S1KavJdxYje8Ot0gBDPhPaPvEvnc7d9XcIHuehFjEj2R54SInllKtfIP142jzouRLsmXahXeWJQnwO16bKynDFHRliPFkw== X-Google-Smtp-Source: AGHT+IEy+CncZLkJ7ZiDAnAaCWvTE3zE2H7IbCW/7CFF8JhUxs81xg7oZrB1zt0zYhNyGmGTHLDs X-Received: by 2002:a50:d714:0:b0:568:d5e7:37a1 with SMTP id t20-20020a50d714000000b00568d5e737a1mr7509686edi.36.1712643825857; Mon, 08 Apr 2024 23:23:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712643825; cv=pass; d=google.com; s=arc-20160816; b=k3f1yiaGB8Zojc15jqdg2DYqpZRf6JCG92aYcY9gko7VLyps0dK6uDgskl7zXhmDhL o5wf79qWlAfeYLADdhz5qQDjWmONu24L1ctivQV6e9Aoio3R2y42rpo0P6Ap2A4ltIad YpKGA2WGvIK0pxA6s/3hrcODgCTKwXklWB+I2LYZdFT25rH7sqaxTFGO4QbAMXQqFxKM 25+SqdFseGjbGtXT2k0k9SNLtS6v4H//fh/wYY4I/G15P0KcfqlCVQhcCdYORVyhjuBD soFIobXN9/nPdWo1KRiUX4LUxulLYxMVja3QHjbmT6AO5trdXG2CTNQ4LvqrWZtstS/a gQ1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt: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=2wv4dy4qt5fBaBHru1E7dQVRFP0uGbCdZP6F+NXrKhY=; fh=JxDqR/thZVkL2Jxs4+uF5hYX2vavxvWNOWBWcHjUedA=; b=Hq+8pfjBCZGjIAHHM2FDYS5VjgS84446n6I712WQ4iSfTcqd1/D4xYFou54PuxrmDW fYibpyOmLgtoo9aL3XWrBE4bNyfe3HFA7OSZdoRQj89SStZc8X2gJdDubyYHkUEibSZp K+FvoKSrdXNrzb6Js5Yo8ZZoXqmHEc9Stend+smkRRmGgqZ0VTbnZi1Akr8TvytgOg81 XMeG1c1dAW4M+qdaC/hyshrWaKZZwODM/pAHoLlWhio8m9FeDRZcnhbO3lmhWjgHavWU OIgo1CrmDRoxEvwDcEU+s/l+AzbV7gHMmQOUsCkdXVD9pLm3/5D1vGOCJg4vjI5TNaV3 f2Cw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="AU/Eam+X"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="37CR/FUU"; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="AU/Eam+X"; 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-136292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136292-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 j26-20020a50d01a000000b0056739aba263si4355870edf.440.2024.04.08.23.23.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 23:23:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136292-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="AU/Eam+X"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="37CR/FUU"; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="AU/Eam+X"; 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-136292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136292-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 139A31F23F98 for ; Tue, 9 Apr 2024 06:23:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D693B71B3D; Tue, 9 Apr 2024 06:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="AU/Eam+X"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="37CR/FUU"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="AU/Eam+X"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="37CR/FUU" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 8ED2C71727 for ; Tue, 9 Apr 2024 06:23:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712643804; cv=none; b=pvDkqM4quQ12MN0axHcPZdtYFT2DF2QSKrqgEhkMKld4TCwGGGC/pKd4RAOsKvQvWJ/NlQfsHx0Dlj0pLFgpGDAqdr0sLp2bqTS5TESI8ZMGqLefTxIXCChysM1sWmr9/8q43e4UkGisw2BT9mcCBhmWfhmmJNZBcTKIOLMiIq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712643804; c=relaxed/simple; bh=QQLwAh9Frhb0NQmVCDxjrhDGsxEX117pOKRmcvX6Pvk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=nuP7oOxiDVWc3jAeu2p2xhGW9gFHwLPYdvD9n3rjq8srTJ17+q4/42Lu0Op7x4mHCjpo9ZxcqP+ghVYRPR6XUJX3Ty+dQs3IXKN5OLSHzoiursrbF2AWEDy7XnFILx+4lrQvuYvKHpCDaUNFLlPatMNvMtQRbI57jyFwU3j5ztk= 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=AU/Eam+X; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=37CR/FUU; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=AU/Eam+X; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=37CR/FUU; arc=none smtp.client-ip=195.135.223.131 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-out2.suse.de (Postfix) with ESMTPS id AA2FD2080A; Tue, 9 Apr 2024 06:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712643800; 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:autocrypt:autocrypt; bh=2wv4dy4qt5fBaBHru1E7dQVRFP0uGbCdZP6F+NXrKhY=; b=AU/Eam+X4HqvNCnR0fB0Rky9yxPCOoHo+Fc9SxirD+LGR/q7/0AmGLvWJ/rD8UfMMePyAq PokQnLP2jaXUZaVl8X1ckd6TH8Bmv+e0VOBENN/eKsUZm1Og/n6vVa2m3CDeEWmGYqzsPs Nlt3If2xLqD98zxFewP7mbaEZ82B0AA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712643800; 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:autocrypt:autocrypt; bh=2wv4dy4qt5fBaBHru1E7dQVRFP0uGbCdZP6F+NXrKhY=; b=37CR/FUUZstI7p9VLLJfFENOSFX4ylFsqKRbQh9NZ+vYaG2BjvdulGI4Vy30nYKI1Wdp47 20/qMtLCCIjTleAA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712643800; 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:autocrypt:autocrypt; bh=2wv4dy4qt5fBaBHru1E7dQVRFP0uGbCdZP6F+NXrKhY=; b=AU/Eam+X4HqvNCnR0fB0Rky9yxPCOoHo+Fc9SxirD+LGR/q7/0AmGLvWJ/rD8UfMMePyAq PokQnLP2jaXUZaVl8X1ckd6TH8Bmv+e0VOBENN/eKsUZm1Og/n6vVa2m3CDeEWmGYqzsPs Nlt3If2xLqD98zxFewP7mbaEZ82B0AA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712643800; 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:autocrypt:autocrypt; bh=2wv4dy4qt5fBaBHru1E7dQVRFP0uGbCdZP6F+NXrKhY=; b=37CR/FUUZstI7p9VLLJfFENOSFX4ylFsqKRbQh9NZ+vYaG2BjvdulGI4Vy30nYKI1Wdp47 20/qMtLCCIjTleAA== 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 9134C13313; Tue, 9 Apr 2024 06:23:20 +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 qzMoI9jeFGbnLAAAD6G6ig (envelope-from ); Tue, 09 Apr 2024 06:23:20 +0000 Message-ID: <1cc1e3d1-4646-436c-92cb-f8584406bf88@suse.cz> Date: Tue, 9 Apr 2024 08:23:20 +0200 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 10/10] mm: page_alloc: consolidate free page accounting Content-Language: en-US To: Johannes Weiner Cc: Baolin Wang , Andrew Morton , Mel Gorman , Zi Yan , "Huang, Ying" , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240320180429.678181-1-hannes@cmpxchg.org> <20240320180429.678181-11-hannes@cmpxchg.org> <7b3b7f2e-7109-4e72-b1cf-259cb56f3629@linux.alibaba.com> <20240408142340.GA1057805@cmpxchg.org> From: Vlastimil Babka Autocrypt: addr=vbabka@suse.cz; keydata= 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 EP+ylKVEKb0Q2A== In-Reply-To: <20240408142340.GA1057805@cmpxchg.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Level: X-Spamd-Result: default: False [-4.29 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; RCPT_COUNT_SEVEN(0.00)[9]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.cz:email] X-Spam-Score: -4.29 X-Spam-Flag: NO On 4/8/24 4:23 PM, Johannes Weiner wrote: > On Mon, Apr 08, 2024 at 09:38:20AM +0200, Vlastimil Babka wrote: >> On 4/7/24 12:19 PM, Baolin Wang wrote: >> > On 2024/3/21 02:02, Johannes Weiner wrote: >> >> >> >> + account_freepages(page, zone, 1 << order, migratetype); >> >> + >> >> while (order < MAX_PAGE_ORDER) { >> >> - if (compaction_capture(capc, page, order, migratetype)) { >> >> - __mod_zone_freepage_state(zone, -(1 << order), >> >> - migratetype); >> >> + int buddy_mt = migratetype; >> >> + >> >> + if (compaction_capture(capc, page, order, migratetype)) >> >> return; >> >> - } >> > >> > IIUC, if the released page is captured by compaction, then the >> > statistics for free pages should be correspondingly decreased, >> > otherwise, there will be a slight regression for my thpcompact benchmark. >> > >> > thpcompact Percentage Faults Huge >> > k6.9-rc2-base base + patch10 + 2 fixes >> > Percentage huge-1 78.18 ( 0.00%) 71.92 ( -8.01%) >> > Percentage huge-3 86.70 ( 0.00%) 86.07 ( -0.73%) >> > Percentage huge-5 90.26 ( 0.00%) 78.02 ( -13.57%) >> > Percentage huge-7 92.34 ( 0.00%) 78.67 ( -14.81%) >> > Percentage huge-12 91.18 ( 0.00%) 81.04 ( -11.12%) >> > Percentage huge-18 89.00 ( 0.00%) 79.57 ( -10.60%) >> > Percentage huge-24 90.52 ( 0.00%) 80.07 ( -11.54%) >> > Percentage huge-30 94.44 ( 0.00%) 96.28 ( 1.95%) >> > Percentage huge-32 93.09 ( 0.00%) 99.39 ( 6.77%) >> > >> > I add below fix based on your fix 2, then the thpcompact Percentage >> > looks good. How do you think for the fix? >> >> Yeah another well spotted, thanks. "slight regression" is an understatement, >> this affects not just a "statistics" but very important counter >> NR_FREE_PAGES which IIUC would eventually become larger than reality, make >> the watermark checks false positive and result in depleted reserves etc etc. >> Actually wondering why we're not seeing -next failures already (or maybe I >> just haven't noticed). > > Good catch indeed. > > Trying to understand why I didn't notice this during testing, and I > think it's because I had order-10 pageblocks in my config. There is > this in compaction_capture(): > > if (order < pageblock_order && migratetype == MIGRATE_MOVABLE) > return false; > > Most compaction is for order-9 THPs on movable blocks, so I didn't get > much capturing in practice in order for that leak to be noticable. > > In earlier versions of the patches I had more aggressive capturing, > but also did the accounting in add_page_to/del_page_from_freelist(), > so capturing only steals what's already accounted to be off list. > > With the __add/__del and the consolidated account_freepages() > optimization, compaction_capture() needs explicit accounting again. > >> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> > index 8330c5c2de6b..2facf844ef84 100644 >> > --- a/mm/page_alloc.c >> > +++ b/mm/page_alloc.c >> > @@ -805,8 +805,10 @@ static inline void __free_one_page(struct page *page, >> > while (order < MAX_PAGE_ORDER) { >> > int buddy_mt = migratetype; >> > >> > - if (compaction_capture(capc, page, order, migratetype)) >> > + if (compaction_capture(capc, page, order, migratetype)) { >> > + account_freepages(zone, -(1 << order), migratetype); >> > return; >> > + } >> > >> > buddy = find_buddy_page_pfn(page, pfn, order, &buddy_pfn); >> > if (!buddy) >> > >> > With my fix, the THP percentage looks better: >> > k6.9-rc2-base base + patch10 + 2 fixes + >> > my fix >> > Percentage huge-1 78.18 ( 0.00%) 82.83 ( 5.94%) >> > Percentage huge-3 86.70 ( 0.00%) 93.47 ( 7.81%) >> > Percentage huge-5 90.26 ( 0.00%) 94.73 ( 4.95%) >> > Percentage huge-7 92.34 ( 0.00%) 95.22 ( 3.12%) >> > Percentage huge-12 91.18 ( 0.00%) 92.40 ( 1.34%) >> > Percentage huge-18 89.00 ( 0.00%) 85.39 ( -4.06%) >> > Percentage huge-24 90.52 ( 0.00%) 94.70 ( 4.61%) >> > Percentage huge-30 94.44 ( 0.00%) 97.00 ( 2.71%) >> > Percentage huge-32 93.09 ( 0.00%) 92.87 ( -0.24%) > > Acked-by: Johannes Weiner Acked-by: Vlastimil Babka > With fixed indentation: Maybe Baolin could resend the finalized 2 fixups in a more ready-to-pick form? > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 70f82635f650..96815e3c22f2 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -805,8 +805,10 @@ static inline void __free_one_page(struct page *page, > while (order < MAX_PAGE_ORDER) { > int buddy_mt = migratetype; > > - if (compaction_capture(capc, page, order, migratetype)) > + if (compaction_capture(capc, page, order, migratetype)) { > + account_freepages(zone, -(1 << order), migratetype); > return; > + } > > buddy = find_buddy_page_pfn(page, pfn, order, &buddy_pfn); > if (!buddy)