Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp996824pxb; Wed, 6 Apr 2022 06:19:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUDAJJ1ZwHv5Iuudd8OFuiJ+zzB16stit3l6eK65SCULPEolxywVO4reKxfPYLVEwtZAXI X-Received: by 2002:a17:90b:4c09:b0:1c7:6c8:43c8 with SMTP id na9-20020a17090b4c0900b001c706c843c8mr9836483pjb.208.1649251175610; Wed, 06 Apr 2022 06:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649251175; cv=none; d=google.com; s=arc-20160816; b=pthOgFflvE9b6TD/NXJZYP1cSxUCy0k726BfhTp+gL5Uap5yLjZEnujXtMTXqgT6Xf xg9cRA2l/lPUPV0eSHLjXajYDzAeY5JrZlfqTM0CO4kykBljoZWjS54OQrwKKQeQT+Gx VQIemhcicl4l3OHthcafv9YnH8h0TuTzikBu+TVWC6OSQhYhu/sh62tctw6N33m+fPA8 DyAZ6feZ++DEsK+BknB9kzyB3xQvwbEx1a/e3WX87nqbvEghOD2h5uPeTXQbmx4DS6QB hZo/HY4gMYkZ0jVyRHJt32qP2YBzkyAOuPi+o5Z0bDZX9MgQ2OC4N1KsHlz0lwj4aWcS pKlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=4gd5jq9JA78+ej6U2SXRWQGkkcWFy9lDISdWZvkme7M=; b=FtudbeKzbeq1qUDZr59m4nE/Hmk+BqigyTIMUTgQE6pk6B/pFTGrMIOhck9MpQhpem WsFqbaeK/rQx5PHQeMzTXxDL8VZBwqQyjq/RwM9PF13Q6qCrkMxJ2KfhfgcbInZ41K1+ NsxWKnl3YVzN1sQZ5z0b1lX9catFZDzhIQdBkpUF5Flc1KpCNBdsKMSxSsNwC+1dnI6J +bxVqM7xp64OnLsjMINdoOT5aJ7VNSnUIMz3gJUwq1yJ5jwDO5XoWFm0j6NVVOk62Fxj NTsyTGgsPcHzNB92GoQOJy7LmNb00Eq1zBF3/wn4rGFiiE3r11JoyJSbiUGGX9qPM+qs vDGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QRnYDueT; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=pM+1pMkG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w9-20020a170902e88900b00153b2d1657fsi16569750plg.391.2022.04.06.06.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:19:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QRnYDueT; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=pM+1pMkG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8B5864CECB7; Wed, 6 Apr 2022 03:56:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391359AbiDEWFU (ORCPT + 99 others); Tue, 5 Apr 2022 18:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354966AbiDEKQt (ORCPT ); Tue, 5 Apr 2022 06:16:49 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B0CE140DD for ; Tue, 5 Apr 2022 03:04:20 -0700 (PDT) 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-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? >