Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp582789pxm; Wed, 2 Mar 2022 04:47:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyq+Tkv+N3zRV+TMfFoMxkp83QcVshiTsTb5On1RDNED8UVEEcNym0yoknybhGhzljEcxG6 X-Received: by 2002:a17:90a:5995:b0:1bc:be7f:f5a1 with SMTP id l21-20020a17090a599500b001bcbe7ff5a1mr27447808pji.84.1646225238150; Wed, 02 Mar 2022 04:47:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646225238; cv=none; d=google.com; s=arc-20160816; b=ZvfMws1DgU6rcQ3pAKMCwF5Ds1WPFnuvtfN/teUxlRe7/bhmsLuDOtVP5HlpHde9aJ H5x+rs8pYdu809wWfZ26eZpTfR5gw95Lwg/xm3jAOlP8Ifnru5ZDVRbo9MCbAHSk/MHy /hBUmg8dZ9XKZvmqofJA/faI5rNdSJNOQ41GeMpMqx0xAUQ/iq4DDik2epa8Ns6dVI2h hvGaXBPgFI42iJf12IStazWoKcbum5CIvLPpIipO32jkdas2AH1l5jrC6dImdRJopQEV 1uaZ43Mi2ZVHMnrDJ08x7UPritzjP8F8TOb8qz9WoIRrtUDvXZ/u3uLtRsQ+CyaMRTyh gwpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5VVuLOyzVojFtdlB1wdXu5nu6vPydR5gopX9RTl4ymY=; b=SbpHJUQaiXFIhsNFSEkDuVYR+ondtE8xIu81LQHCB6laGjqT6Vt3yz+7vWk8Cwx0ja MfSyeJNR13a6FPOpy2EHCZsnfyhGkrUEa5A9k8QpepCThFTDx1uwY32+3F0Luulvbv+Q Hq1dZ35mgg90Wu8Kr0TcSHCfF9DUF0hgKzEOt8uBBNwmr9+6MQC1vbTwmghEe3Drl3sY 0GeJ3f+RRsgQ9YF4WysS1VLeiFJcNKEnGzKvimBfOd5l41SU19J7aqEHibA/hEa29ieK eiV+tjJO0w/5WKCuuK63/Hi30tmyABcOi99NFqhhoHxc4UyloTLTWnZU4vsoZj+AiXyy lUgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="hzHwr/X8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a170902ce0c00b0014d9b77957esi15696313plg.88.2022.03.02.04.47.00; Wed, 02 Mar 2022 04:47:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="hzHwr/X8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238605AbiCAVcV (ORCPT + 99 others); Tue, 1 Mar 2022 16:32:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231863AbiCAVcU (ORCPT ); Tue, 1 Mar 2022 16:32:20 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C5E781190; Tue, 1 Mar 2022 13:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=5VVuLOyzVojFtdlB1wdXu5nu6vPydR5gopX9RTl4ymY=; b=hzHwr/X84crorF5eqeeLqMG9h0 8LdN1r0CUxK5OhHZJsKcqS4ut++icTOMJ/PjT8hnPOWsG133TDvYyNtY9qzdxcZtFA7ZHHvbXFeXp LWduIdbEN4fCsup6Io73V7hKDAGPcqZ20fAim9GmOmSC1lg03UgsDCAABTY2BiAM4pnYTaWE35Pmw CtJepFr99HGihM7nUoyJ2gICUJjdtkCKLsy2vEerFGML6tLQTB301uh/SBSfSOFF92Ig/IqWdc3ax nV521LwOTFx7jzMNoonpPUABoLOliEKFruuxE50hMt4zv2TTLbygsnAIIcbodwzUNFKdoLd1ZnzOV PS5oyBGg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPA5Y-000dS7-1r; Tue, 01 Mar 2022 21:31:20 +0000 Date: Tue, 1 Mar 2022 13:31:20 -0800 From: Luis Chamberlain To: "Eric W. Biederman" Cc: Shakeel Butt , Colin Ian King , NeilBrown , Vasily Averin , Vlastimil Babka , Michal Hocko , Roman Gushchin , Linux MM , netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Tejun Heo , Greg Kroah-Hartman , Eric Dumazet , Kees Cook , Hideaki YOSHIFUJI , David Ahern , linux-kernel@vger.kernel.org, kernel@openvz.org Subject: Re: [PATCH RFC] net: memcg accounting for veth devices Message-ID: References: <20220301180917.tkibx7zpcz2faoxy@google.com> <87wnhdwg75.fsf@email.froward.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Tue, Mar 01, 2022 at 01:25:16PM -0800, Luis Chamberlain wrote: > diff --git a/kernel/ucount.c b/kernel/ucount.c > index 4f5613dac227..980ffaba1ac5 100644 > --- a/kernel/ucount.c > +++ b/kernel/ucount.c > @@ -238,6 +238,8 @@ struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, > long max; > tns = iter->ns; > max = READ_ONCE(tns->ucount_max[type]); > + if (atomic_long_read(&iter->ucount[type]) > max/16) > + cond_resched(); > if (!atomic_long_inc_below(&iter->ucount[type], max)) > goto fail; You can of course ignore this, it was just a hack to try to avoid a soft lockup on the workqueues. Luis