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 895B6C35273 for ; Tue, 5 Apr 2022 10:04:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A8606B0071; Tue, 5 Apr 2022 06:04:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 658136B0073; Tue, 5 Apr 2022 06:04:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F8CD6B0074; Tue, 5 Apr 2022 06:04:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id 3CEFD6B0071 for ; Tue, 5 Apr 2022 06:04:32 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id ED1988249980 for ; Tue, 5 Apr 2022 10:04:21 +0000 (UTC) X-FDA: 79322390322.20.D42C80E Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf15.hostedemail.com (Postfix) with ESMTP id 4570BA0033 for ; Tue, 5 Apr 2022 10:04:20 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E4F71210E5; Tue, 5 Apr 2022 10:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1649153058; 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=4gd5jq9JA78+ej6U2SXRWQGkkcWFy9lDISdWZvkme7M=; b=QRnYDueTv6FkkyOXeKf43xTyrX0Yg9FflXn2fWwaWwdJFLNu0c6HbZDoY7Ma0C2gSflO6o UmVMyuhlhQbviWmktRTT/xjHDVpE9ymF1UTcNlDEwUuXp04BRAT5vWg0SS8ssrIcxxZUZb Rekl/2oHVTABt8v9B6SLwW/BE7lc1zo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1649153058; 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=4gd5jq9JA78+ej6U2SXRWQGkkcWFy9lDISdWZvkme7M=; b=pM+1pMkGX4wEBvlh5Vkd7pClTEFyjosT5PfCpAt/FqHQtyEktuTgm6u4Ji7qiyMEiDeQzg M8gL++iLBDtrbDBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C049313A04; Tue, 5 Apr 2022 10:04:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xt8kLiIUTGK2RgAAMHmgww (envelope-from ); Tue, 05 Apr 2022 10:04:18 +0000 Message-ID: <76c63237-c489-b942-bdd9-5720042f52a9@suse.cz> Date: Tue, 5 Apr 2022 12:04:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2 1/2] mm, slub: change percpu partial accounting from objects to pages Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: linux-mm@kvack.org, Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , Jann Horn , linux-kernel@vger.kernel.org, Roman Gushchin References: <20211012134651.11258-1-vbabka@suse.cz> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: u35ciwpg87chz8ees1f6fxcqkpwa1uzi Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=QRnYDueT; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=pM+1pMkG; spf=pass (imf15.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4570BA0033 X-HE-Tag: 1649153060-948340 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: On 3/20/22 06:13, Hyeonggon Yoo wrote: >> While this is no longer a problem in kmemcg context thanks to the accounting >> rewrite in 5.9, the memory waste is still not ideal and it's questionable >> whether it makes sense to perform free object count based control when object >> counts can easily become so much inaccurate. So this patch converts the >> accounting to be based on number of pages only (which is precise) and removes >> the page->pobjects field completely. This is also ultimately simpler. >> >> To retain the existing set_cpu_partial() heuristic, first calculate the target >> number of objects as previously, but then convert it to target number of pages >> by assuming the pages will be half-filled on average. This assumption might >> obviously also be inaccurate in practice, but cannot degrade to actual number of >> pages being equal to the target number of objects. > > I have to agree that this half-filled assumption works pretty well and > I believe the too-long-partial-list problem has gone. we're controlling > its length clearly after this patch. > > But my one concern here is that actual number of objects in > percpu partial list can be decreased when we cannot allocate high order pages. > > e.g.) oo_order(s->oo) is 3 and we can only allocate order-2 page, > it can be shortened 2 times in worst case because the accounting logic > assumes order of all slab in the percpu partial list is oo_order(s->oo). That's true, but let's not forget the percpu partial lists are motivated by peak performance in e.g. networking. Once we start having issues allocating e.g. order-2 pages due to fragmentation, the system is probably far from peak performance already, so this pessimism in slub partial lists is not the main concern. > I think using object based accounting, and assuming every slab is > half-filled would be more consistent when the system is highly > fragmented. Based on reasoning above, I doubt it's worth the trouble. Thanks. > Thoughts? >