Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1238759lfc; Wed, 1 Jun 2022 12:43:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhPAZRZ/yYIWLZ7hjXp+9faK+ZLu/YJrvXO3Wv4/3eoryhFCYLEWx9DFxypKYSPR8VcUS5 X-Received: by 2002:a17:902:b214:b0:161:f6d8:45cd with SMTP id t20-20020a170902b21400b00161f6d845cdmr1020641plr.95.1654112619084; Wed, 01 Jun 2022 12:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654112619; cv=none; d=google.com; s=arc-20160816; b=N5+0unLjD3VLbnJvbYBpxbcR7x0dGZkUGs4kdDil/SghWKZawcYT95tD+mpF5fe8v6 zgoQsCr9tnEFOulAuRoqRhP/WRYkemCztGTI//HwkAr6iwZI8FpgZijqRj91tZW1TQBI vXr2TJZ0xYCq5fTN8gyONQz55UxTDdTKMFD5qaDnzjLxJZ1pYwzIk9dhCpdnjwE62rQ/ OgfkK870Ll4iPAEgqJIVOqSEQEX8tmVEYtmFvmvOWeQWxdfJbQLwalDqt+i4oCYvYJOV ssrQY5lr7YxzlJJ0F8KluiK6ieqoNHRyTrZ6bVpvFNcpHvDYcM7zH4e0ZDPi6PgykTMh gmgA== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=LJrHD/fk/T3aZT3PXrEdxCfOFI/2TTZWKV2+KGqpvvM=; b=bJaRDNNpDYDSt9B3nuZwnmAeqgjZ/+P3cUFs8facvQlI38/kfxK5axBbxDKoW3hupb 4NMVdVf/ERr3INqQHflU9v14UlMFlWeVyszE0wpRqcwY85joVXf6PGCKWHfctZbJx835 5raQx60/CKhWKNRnJXa3vGMaRwPXYxxg0SCG1FiUN6e7jUBBGPKnYdHUr5mqP6YZ/GcB yxxtfJ8zc+eqfUuWiWdt6sED2t4+x1B1QVVoLIKX9VOGakysadDrQdYGzf7hlTVLtKVQ NBXS2yQKCnOp6+mZMQ+XEVmqFSQIoIHafxoJluqaEND4WGUCe7WZaigsg6pD8Bzzk9wt u70g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aNGf2iRm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e5-20020a170902784500b0016399622169si3859742pln.46.2022.06.01.12.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 12:43:39 -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=@redhat.com header.s=mimecast20190719 header.b=aNGf2iRm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 910751D05A2; Wed, 1 Jun 2022 12:09:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240348AbiFAJG7 (ORCPT + 99 others); Wed, 1 Jun 2022 05:06:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351092AbiFAJFs (ORCPT ); Wed, 1 Jun 2022 05:05:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D8FFB8FD40 for ; Wed, 1 Jun 2022 02:05:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654074346; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LJrHD/fk/T3aZT3PXrEdxCfOFI/2TTZWKV2+KGqpvvM=; b=aNGf2iRmXCzzIGp2B58fd7be9Ft6UN+m4e6D6Ibopcat1uCbWk3Z5SFCd8k1VTHYuhbaOE BeUmeedvj9w8hvg+DTT2+5d2GACPjP1wmNszpNPpuvukixkdAc8PY4RyT5mF+kCPyjW+1R BL3flYIjH/F5qDsVHSE+l6VFmSQ+X60= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-503-SEfhaGWBNdG90if3VbGy9A-1; Wed, 01 Jun 2022 05:05:44 -0400 X-MC-Unique: SEfhaGWBNdG90if3VbGy9A-1 Received: by mail-wm1-f71.google.com with SMTP id n18-20020a05600c3b9200b0039746f3d9faso615961wms.4 for ; Wed, 01 Jun 2022 02:05:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=LJrHD/fk/T3aZT3PXrEdxCfOFI/2TTZWKV2+KGqpvvM=; b=154v/X9r/QuKW5mwIPef5BMyo1cQ+fgrEu2B7+igbpK3cd5VRspCc3h2hfJezLgq17 HEwx/02YFyNZI86LKYIvMZXo5QIVD8SyNXeB8nf6hkvaW85+Abrl0Q02fBoeWTQ+w/Ec KHfvpIKVMiWdyDtOciw6qHqS3mPAd+2N9Rjf+ZMRzvM7CkUZl50HIDo1ZdejHRGBi9oY YjN2Ux8mlkhiUGV9mIFtNShrrPZKq2WUNZIHfwWkIxgs9XZe7cD8c+2tiqHHkszrHiO2 2jelZIIOhCpFmFn2qGvsVgKLOtAAKv22DGrrRH6wI1jIaAPbIOUdZrn9JcQJtMEPn19u 137w== X-Gm-Message-State: AOAM53329LjRptw+N/n+4IsfEN5yXzDl/W6uHrpy7hO4fe7EYWUta46o +CmHgqY/opEDlaNMgRPtonUMQX2Sc0n/ISlp5Bq3W9LcYldPIzwCdBtmUweASbZhXSVEG9AO09d CzsFqPQBAe4GXkCa0mcAxS0k/ X-Received: by 2002:adf:fc01:0:b0:20c:ff9a:2c53 with SMTP id i1-20020adffc01000000b0020cff9a2c53mr52818622wrr.142.1654074343772; Wed, 01 Jun 2022 02:05:43 -0700 (PDT) X-Received: by 2002:adf:fc01:0:b0:20c:ff9a:2c53 with SMTP id i1-20020adffc01000000b0020cff9a2c53mr52818592wrr.142.1654074343514; Wed, 01 Jun 2022 02:05:43 -0700 (PDT) Received: from ?IPV6:2003:cb:c705:2600:951d:63df:c091:3b45? (p200300cbc7052600951d63dfc0913b45.dip0.t-ipconnect.de. [2003:cb:c705:2600:951d:63df:c091:3b45]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b00397342e3830sm7173656wms.0.2022.06.01.02.05.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jun 2022 02:05:42 -0700 (PDT) Message-ID: <76adccb2-2925-e102-db6f-529492d885c7@redhat.com> Date: Wed, 1 Jun 2022 11:05:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCHv6 15/15] mm/vmstat: Add counter for memory accepting Content-Language: en-US To: "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Dave Hansen , Mike Rapoport , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> <20220517153444.11195-16-kirill.shutemov@linux.intel.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220517153444.11195-16-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 17.05.22 17:34, Kirill A. Shutemov wrote: > The counter increased every time kernel accepts a memory region. > > The counter allows to see if memory acceptation is still ongoing and > contributes to memory allocation latency. > > Signed-off-by: Kirill A. Shutemov > --- > arch/x86/mm/unaccepted_memory.c | 1 + > include/linux/vm_event_item.h | 3 +++ > mm/vmstat.c | 3 +++ > 3 files changed, 7 insertions(+) > > diff --git a/arch/x86/mm/unaccepted_memory.c b/arch/x86/mm/unaccepted_memory.c > index 6ecd79101922..fe1dabfae326 100644 > --- a/arch/x86/mm/unaccepted_memory.c > +++ b/arch/x86/mm/unaccepted_memory.c > @@ -74,6 +74,7 @@ void accept_memory(phys_addr_t start, phys_addr_t end) > } > > bitmap_clear(bitmap, range_start, len); > + count_vm_events(ACCEPT_MEMORY, len * PMD_SIZE / PAGE_SIZE); > It's a bit weird that this is accounted from arch code. Also, I'm a bit confused about the granularity here (PMD_SIZE). > /* In early boot nr_unaccepted is not yet initialized */ > if (nr_unaccepted) { > diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h > index 16a0a4fd000b..6a468164a2f9 100644 > --- a/include/linux/vm_event_item.h > +++ b/include/linux/vm_event_item.h > @@ -136,6 +136,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, > #ifdef CONFIG_X86 > DIRECT_MAP_LEVEL2_SPLIT, > DIRECT_MAP_LEVEL3_SPLIT, > +#endif > +#ifdef CONFIG_UNACCEPTED_MEMORY > + ACCEPT_MEMORY, > #endif > NR_VM_EVENT_ITEMS > }; > diff --git a/mm/vmstat.c b/mm/vmstat.c > index b75b1a64b54c..4c9197f32406 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -1397,6 +1397,9 @@ const char * const vmstat_text[] = { > "direct_map_level2_splits", > "direct_map_level3_splits", > #endif > +#ifdef CONFIG_UNACCEPTED_MEMORY > + "accept_memory", > +#endif > #endif /* CONFIG_VM_EVENT_COUNTERS || CONFIG_MEMCG */ > }; > #endif /* CONFIG_PROC_FS || CONFIG_SYSFS || CONFIG_NUMA || CONFIG_MEMCG */ How exactly would I be able to figure out if "memory acceptation is still ongoing" if there is one last remaining page stuck at the tail of the freelist? Wouldn't it make more sense to actually count the number of unaccepted pages in the buddy? Once that number drops to 0, one knows that there is no unaccepted memory left in the buddy. -- Thanks, David / dhildenb