Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1654860ybg; Wed, 23 Oct 2019 20:33:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMJGQyTZqiULYvuk0ZgRU5vt8Hjr3yZutTtMlfaLO5xpcvHGjN957QC1SvBgcsmHxIklYR X-Received: by 2002:a17:906:6d4f:: with SMTP id a15mr16797037ejt.33.1571888004119; Wed, 23 Oct 2019 20:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571888004; cv=none; d=google.com; s=arc-20160816; b=kLYx9iURQUGh491o8046+ZJcUAl36NjU1XXY5AXR3VIxfNXe8mmcWum48SWTLDZaon +tx/N7u3xa9+iy6fX9gASO1XDkwMMnzlB1+KR0RHNuESKdqLar08KS3mcyodSkFNxRaT kJk+fitLLYYpTEzgtgc7GJMMCCfZEQIQEFm2uxh76owAx1xQ94cCUr6g9SFss0nEtIYR ZkECNm1Lvhkz5dcRpWEsxjsvMQeOlrvlmozYfZfDC1r/8ABGumKMfQYOmKB6zZF/PDTj /wDjM6omUVmBYIBkW+jgl+bqgmpvsCGBupr+a2NuRnyrEeVz+V3tJtiyQQC0V9wRvrdx 2YXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:references:cc:to:from:subject :dkim-signature; bh=93aeFP5T+vRMcJvg4/fDd9Eq3JQGr3j/oyGTUsAl3c8=; b=wWvf+OOPIWXCDr2DnkJtHKtWgvukDfPX6G08ks9fDBS/2cZN1iMXCtx1GRDEWinwvH oryqVVbc7keqFOMiRwMpmxKroCWBkhLyg+byTwdfJZq4lLKPth7ppOWrNi806Jpq9b7r 7tAsjY+ANUuxbk5UYkLxICEv6WlA6tcaUqAko/K2Wiys1OtW4Syvg8usrLqUlt8DCK65 c9BQAUcx3/eKP1IBJm+Krg71t6sVboHMqc4X2PDeFlAjUgeE+NcxNmDxkAf4KK/zyCVK IGUaaD7agFudQ4JwRCrEPUBgnEsVw59gBIuot7eavXue8IilaDpPkKlupodL2e0oe5rj l9sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=X6XOxHcs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2si14580235ejj.327.2019.10.23.20.32.59; Wed, 23 Oct 2019 20:33:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=X6XOxHcs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406621AbfJWPVK (ORCPT + 99 others); Wed, 23 Oct 2019 11:21:10 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57218 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2406602AbfJWPVJ (ORCPT ); Wed, 23 Oct 2019 11:21:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571844068; 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=93aeFP5T+vRMcJvg4/fDd9Eq3JQGr3j/oyGTUsAl3c8=; b=X6XOxHcsPUVkExbGbppmroJ8efNJVeE0cdUS9YOlHlJu/G8iKuYc05J+kYS4KVQE/mzqq8 r/wPdp+YrIFs+u1kLr3mEgEgWqIr2z+MWEKs06KbLOZdc7fxLpdbGV+P1ahgkkRNsnXEYS IDYtdBLh7nt8KFLPx56l4PGGssBVOqc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-3MTVpcEMNnCZYTLXuZa83Q-1; Wed, 23 Oct 2019 11:21:04 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB7A1107AFA9; Wed, 23 Oct 2019 15:21:02 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-59.bos.redhat.com [10.18.17.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3036A1001B20; Wed, 23 Oct 2019 15:21:01 +0000 (UTC) Subject: Re: [RFC PATCH 2/2] mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo From: Waiman Long To: Michal Hocko , Andrew Morton , Mel Gorman Cc: Johannes Weiner , Roman Gushchin , Vlastimil Babka , Konstantin Khlebnikov , Jann Horn , Song Liu , Greg Kroah-Hartman , Rafael Aquini , linux-mm@kvack.org, LKML , Michal Hocko References: <20191023095607.GE3016@techsingularity.net> <20191023102737.32274-1-mhocko@kernel.org> <20191023102737.32274-3-mhocko@kernel.org> Organization: Red Hat Message-ID: Date: Wed, 23 Oct 2019 11:21:00 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 3MTVpcEMNnCZYTLXuZa83Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/23/19 10:56 AM, Waiman Long wrote: > On 10/23/19 6:27 AM, Michal Hocko wrote: >> From: Michal Hocko >> >> pagetypeinfo_showfree_print is called by zone->lock held in irq mode. >> This is not really nice because it blocks both any interrupts on that >> cpu and the page allocator. On large machines this might even trigger >> the hard lockup detector. >> >> Considering the pagetypeinfo is a debugging tool we do not really need >> exact numbers here. The primary reason to look at the outuput is to see >> how pageblocks are spread among different migratetypes therefore putting >> a bound on the number of pages on the free_list sounds like a reasonable >> tradeoff. >> >> The new output will simply tell >> [...] >> Node 6, zone Normal, type Movable >100000 >100000 >100000 >100= 000 41019 31560 23996 10054 3229 983 648 >> >> instead of >> Node 6, zone Normal, type Movable 399568 294127 221558 102119 = 41019 31560 23996 10054 3229 983 648 >> >> The limit has been chosen arbitrary and it is a subject of a future >> change should there be a need for that. >> >> Suggested-by: Andrew Morton >> Signed-off-by: Michal Hocko >> --- >> mm/vmstat.c | 19 ++++++++++++++++++- >> 1 file changed, 18 insertions(+), 1 deletion(-) >> >> diff --git a/mm/vmstat.c b/mm/vmstat.c >> index 4e885ecd44d1..762034fc3b83 100644 >> --- a/mm/vmstat.c >> +++ b/mm/vmstat.c >> @@ -1386,8 +1386,25 @@ static void pagetypeinfo_showfree_print(struct se= q_file *m, >> =20 >> =09=09=09area =3D &(zone->free_area[order]); >> =20 >> -=09=09=09list_for_each(curr, &area->free_list[mtype]) >> +=09=09=09list_for_each(curr, &area->free_list[mtype]) { >> =09=09=09=09freecount++; >> +=09=09=09=09/* >> +=09=09=09=09 * Cap the free_list iteration because it might >> +=09=09=09=09 * be really large and we are under a spinlock >> +=09=09=09=09 * so a long time spent here could trigger a >> +=09=09=09=09 * hard lockup detector. Anyway this is a >> +=09=09=09=09 * debugging tool so knowing there is a handful >> +=09=09=09=09 * of pages in this order should be more than >> +=09=09=09=09 * sufficient >> +=09=09=09=09 */ >> +=09=09=09=09if (freecount > 100000) { >> +=09=09=09=09=09seq_printf(m, ">%6lu ", freecount); It will print ">100001" which seems a bit awk and will be incorrect if it is exactly 100001. Could you just hardcode ">100000" into seq_printf()? Cheers, Longman