Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3505516pxf; Mon, 15 Mar 2021 11:02:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTnSVtats97Eosb8cX9NfCJWbwFEclzGI0kiqQW6K9a7xi8PI4vLvPsKL0gH+LPkFz+e8c X-Received: by 2002:aa7:d2d5:: with SMTP id k21mr30872979edr.216.1615831340556; Mon, 15 Mar 2021 11:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831340; cv=none; d=google.com; s=arc-20160816; b=ZF5WAL1DSomPB2CfaypUFhdkJM+goDhngMzkOujJq+IFJwwazel6EPkzPtILqdx71P cJL5z+FSFElEsnJvs1N+BQF+iQXGJQUES7CKmCSGuZjzsAe3nsrsCNBypkmLWQGqBij3 DvVhb1k69cLIzORZWWTUyFdFc5FtL8GcqdyDU8B1OzsB++I5sKvJYWVvJq7wefxrnm7L GMbO/DzTi/X8XQnM7gt72uRyWl8GOnbaC4v33ok9gslpZkDHkca1aDcNUZU2w6tKLMkv cQVynDaxzqGckcYah9DKymHW0QJAzOuQ7qCwtWJpylyNs+0I1x+C47rE+Oa0lsqNjTDo +Alg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GfIRo5HVfte/vPuCpUzGtJZ5EsZB++z0u6jXijnW58s=; b=Ut44hiQIYZAw6w7DbwihpnnEKhlXGXAEhGgYA5uezhDAWe4h+6Rm8Sw899UZKIScLT EekjEf4faABTq2VsTcsI61ztXK/tLeGQTEp0QElzXRGvf1ANKw0vNu5/pCLOIXjR6B/i fcxKhQlrqVFyKbl2QYp9/qw9RAdhSofNvPyOcWhGS5gtaeZIbnqg0m1vPrmxZ93rCYe8 0TaSGxDHeOxn9tZ4EZn0Uh5TcvXxqTehhZw9+DeLVF3hG149D9ynDVQDHiXoM+nmQTrr dIkV1ck6eyvQKkX+oDwb6PP2DhaDdeejdrJheEW5PVJ/NdSm0ZQFhXtYxWvRFNyG6C69 yyYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HyALGZnY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw19si11289705edb.211.2021.03.15.11.01.58; Mon, 15 Mar 2021 11:02:20 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HyALGZnY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234794AbhCOOGK (ORCPT + 99 others); Mon, 15 Mar 2021 10:06:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:34534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbhCON5b (ORCPT ); Mon, 15 Mar 2021 09:57:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B47D164EEE; Mon, 15 Mar 2021 13:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816651; bh=vZJxMxFVx53QcEFBym8JbE6COW0GyV+hS+ctikMbVCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HyALGZnYDg/f6OUzDqWo/Bvu5+W5QUGuKyD7bjFmWWdcih4pHybBbqCqV5gCuG6Ep 3Lpr23CyUQ8zzZimhStwzeT9hrNh6VXvOs6/YgWgvqKTB4SzC9pz3aXWyMJ18zM/zt cBri70RBrzwGmYY7Qd0c0kwl6IiWOx2o9qwfh0ZM= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Jann Horn , David Rientjes , Joonsoo Kim , Christoph Lameter , Linus Torvalds Subject: [PATCH 5.11 042/306] Revert "mm, slub: consider rest of partial list if acquire_slab() fails" Date: Mon, 15 Mar 2021 14:51:45 +0100 Message-Id: <20210315135509.068870112@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Linus Torvalds commit 9b1ea29bc0d7b94d420f96a0f4121403efc3dd85 upstream. This reverts commit 8ff60eb052eeba95cfb3efe16b08c9199f8121cf. The kernel test robot reports a huge performance regression due to the commit, and the reason seems fairly straightforward: when there is contention on the page list (which is what causes acquire_slab() to fail), we do _not_ want to just loop and try again, because that will transfer the contention to the 'n->list_lock' spinlock we hold, and just make things even worse. This is admittedly likely a problem only on big machines - the kernel test robot report comes from a 96-thread dual socket Intel Xeon Gold 6252 setup, but the regression there really is quite noticeable: -47.9% regression of stress-ng.rawpkt.ops_per_sec and the commit that was marked as being fixed (7ced37197196: "slub: Acquire_slab() avoid loop") actually did the loop exit early very intentionally (the hint being that "avoid loop" part of that commit message), exactly to avoid this issue. The correct thing to do may be to pick some kind of reasonable middle ground: instead of breaking out of the loop on the very first sign of contention, or trying over and over and over again, the right thing may be to re-try _once_, and then give up on the second failure (or pick your favorite value for "once"..). Reported-by: kernel test robot Link: https://lore.kernel.org/lkml/20210301080404.GF12822@xsang-OptiPlex-9020/ Cc: Jann Horn Cc: David Rientjes Cc: Joonsoo Kim Acked-by: Christoph Lameter Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/slub.c +++ b/mm/slub.c @@ -1973,7 +1973,7 @@ static void *get_partial_node(struct kme t = acquire_slab(s, n, page, object == NULL, &objects); if (!t) - continue; /* cmpxchg raced */ + break; available += objects; if (!object) {