Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp915927pxu; Thu, 15 Oct 2020 21:43:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGA887ophlO7r8jErkJzkznc3Zc/uSNeW2ynNDi/HoT5PrpZ/YIYlCojscu2wz1s6K989P X-Received: by 2002:a17:906:3cc:: with SMTP id c12mr1856366eja.216.1602823398998; Thu, 15 Oct 2020 21:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602823398; cv=none; d=google.com; s=arc-20160816; b=OSHTeupQkwK3xgDJivKsKIvpD2c7hm5ysbD1Fx0BKsbDVNDxZiywEQ9WPxMko6NSxX 2uWFIQv5HpsgnoaLIsbBl+E6D4CPfY6CyuiIUUl3g/cSru7YAH2farzYwZeKPMbNc5/H LSdLRIcGX+R8ZbtoZ7/DL4d1XGHP7TcMqE2KoHrK4Oawyk20EdtUbjypGY0pmTNb2ict Aioy3sv79bXR3xd4EdjxjTq8PdVINX8FD8N+dmOIp2gQfYH7i4DZYGQsdFHzFdRASic+ gQJ/Gz9iLkq6A1ud6PiECufGcyadUIWVf+upEvVSYfdbH556NZX6l3L03HW92YbV5dKL 770Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=12/GJM5ZdPUu4PKK0xY+WbC3Xk+MoP04SYSm7e4LNIE=; b=ad7RsB4sczDbitHUC1xVvkgjgfzMfHzqgJyxlazMk6konipOJwPDI4ZixUg/EZKANB tnjsv27Ln7daSQsZJHR/VXjiRPuwWRCUgm1JjmVKC/ams8Eefe/uJqJaPsQ8Bc2QSQQw FK9d9N3XBSzFskwfucKX5wc1lAHUm3VOlyf+JgFhfC8qEQAUnLbmhKCb/1wthg3vQCvK AuupW6aQZzIW68LK840QaXHDNaV0shA0eb58OgfYpJEuXZ9D+YbbscDIoyoKvbqq16/t j9Yh122xrUNq0OECyAMqdf9ukU2C2n7XCeNRbGPGjFEn0jE7QWMdx8o/D91aAT0f+RUg x1zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c6si963620ejr.584.2020.10.15.21.42.57; Thu, 15 Oct 2020 21:43:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394274AbgJPDuG (ORCPT + 99 others); Thu, 15 Oct 2020 23:50:06 -0400 Received: from smtp.h3c.com ([60.191.123.56]:34848 "EHLO h3cspam01-ex.h3c.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394270AbgJPDuF (ORCPT ); Thu, 15 Oct 2020 23:50:05 -0400 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([10.8.0.66]) by h3cspam01-ex.h3c.com with ESMTPS id 09G3nW3G052206 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 16 Oct 2020 11:49:32 +0800 (GMT-8) (envelope-from tian.xianting@h3c.com) Received: from localhost.localdomain (10.99.212.201) by DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 16 Oct 2020 11:49:34 +0800 From: Xianting Tian To: CC: , , Xianting Tian Subject: [PATCH] mm: vmscan: avoid a unnecessary reschedule in shrink_slab() Date: Fri, 16 Oct 2020 11:39:52 +0800 Message-ID: <20201016033952.1924-1-tian.xianting@h3c.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.99.212.201] X-ClientProxiedBy: BJSMTP01-EX.srv.huawei-3com.com (10.63.20.132) To DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) X-DNSRBL: X-MAIL: h3cspam01-ex.h3c.com 09G3nW3G052206 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In shrink_slab(), it directly goes to 'out' label only when it can't get the lock of shrinker_rwsew. In this case, it doesn't do the real work of shrinking slab, so we don't need trigger a reschedule by cond_resched(). Signed-off-by: Xianting Tian --- mm/vmscan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 466fc3144..676e97b28 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -687,8 +687,9 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, } up_read(&shrinker_rwsem); -out: + cond_resched(); +out: return freed; } -- 2.17.1