Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6559028ybv; Wed, 12 Feb 2020 14:53:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwhilc3/4q0wSHG1tLoPqve95d4G2P1I/2cu+Cjo4iHriGTYnlQPv7N3Y63+kNqGfxgmPGD X-Received: by 2002:a05:6808:8e1:: with SMTP id d1mr1001438oic.68.1581548008584; Wed, 12 Feb 2020 14:53:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581548008; cv=none; d=google.com; s=arc-20160816; b=lO9YWXgC975wdN0KGKu0II2R7Z7gtzklNQBALsTMfvH2eKI4BWnDndq4MN8HX7OQfv 4ga16OeYKpFoW5PAnvNYNZh+jEu8h1mFteJ573BQq8c0FXrpHQMAWk+9nx9zBWZs2J90 gEZTQaPHCPl4fXfapFU4VEW3lZ29fes2w5x+HpkqtV4Os4cmWt5cGfhvPmeVZv/bWyJq 8Jz/pkL+KvaKHrYLx6uP7b+UwII0kKKFCAHh4UQSLmTay5BDDFvzOC1fk/JCxZm0QQC9 hwUPHxsyTNePpNKThYW0j0GDjwBYPCOvDRsTOZn1Kfm7eE8+AXQ59zC/4FVGuzxPPLOr zInw== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=HOegGDOEQtfeM1Wo5bBYgAsJMakDntd9JOhY/Hp4ZTU=; b=SdN1DVggemf+pIDBi95NJ9uCWLEn4wrCKYlB6WiJUsZr2orAZkReJ+6IJaxEWHAWAS Dpzh8BApH+K2MYIVgsxv8LgBH1pcZpv47fC+ci+m9FvQl4kv8/VzYwnsPG6GOLjnGanr varkY9iJQIeot2QXVC2ijxEBpMLnOIBaiHExwJi8b96Map18m0Ufc+35rTpOB0z56t5M bPwyGWKP4UdP+7WlZwp+T5fwha35NHQjGarJ2pPalhZScGKa3dG4LsaKTXArO2IgXeba HPo9CyRFYsfOsuqVsJ8zxEpd5wwdGR03QlIdrDv+cdhcv0SLD2B4OitdBz9PTRai9i1G wkhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zuNm1oa0; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l83si253462oih.58.2020.02.12.14.53.16; Wed, 12 Feb 2020 14:53:28 -0800 (PST) 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=@kernel.org header.s=default header.b=zuNm1oa0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729195AbgBLWwu (ORCPT + 99 others); Wed, 12 Feb 2020 17:52:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:42018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728185AbgBLWwu (ORCPT ); Wed, 12 Feb 2020 17:52:50 -0500 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4FD0F21569; Wed, 12 Feb 2020 22:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581547968; bh=czm5xq+x3zJ0qiiciKQ7bQR74vUISbw6BSBaEMWk+v8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=zuNm1oa0KqzLmGecolzIK96Aen9gbLKh539V852DcgfooBlUqDHM8Dh1WhGN+RCPc 4EJ8rxzhQiP7/9z5DXF9mrG7La8PdWlR8B7b9wdPi+4o3G3lHbzCHXms0sBjRzMwyE 53NBNngLXNx2L9ebFt9dI1YLuLNOQIInbDyUkTtc= Date: Wed, 12 Feb 2020 14:52:47 -0800 From: Andrew Morton To: Wen Yang Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Xunlei Pang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/slub: Detach node lock from counting free objects Message-Id: <20200212145247.bf89431272038de53dd9d975@linux-foundation.org> In-Reply-To: <20200201031502.92218-1-wenyang@linux.alibaba.com> References: <20200201031502.92218-1-wenyang@linux.alibaba.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 1 Feb 2020 11:15:02 +0800 Wen Yang wrote: > The lock, protecting the node partial list, is taken when couting the free > objects resident in that list. It introduces locking contention when the > page(s) is moved between CPU and node partial lists in allocation path > on another CPU. So reading "/proc/slabinfo" can possibily block the slab > allocation on another CPU for a while, 200ms in extreme cases. If the > slab object is to carry network packet, targeting the far-end disk array, > it causes block IO jitter issue. > > This fixes the block IO jitter issue by caching the total inuse objects in > the node in advance. The value is retrieved without taking the node partial > list lock on reading "/proc/slabinfo". > > ... > > @@ -1768,7 +1774,9 @@ static void free_slab(struct kmem_cache *s, struct page *page) > > static void discard_slab(struct kmem_cache *s, struct page *page) > { > - dec_slabs_node(s, page_to_nid(page), page->objects); > + int inuse = page->objects; > + > + dec_slabs_node(s, page_to_nid(page), page->objects, inuse); Is this right? dec_slabs_node(..., page->objects, page->objects)? If no, we could simply pass the page* to inc_slabs_node/dec_slabs_node and save a function argument. If yes then why? > free_slab(s, page); > } >