From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13211C433DB for ; Mon, 15 Mar 2021 16:32:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8FA1864E42 for ; Mon, 15 Mar 2021 16:32:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FA1864E42 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EE4606B0070; Mon, 15 Mar 2021 12:32:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E93196B0071; Mon, 15 Mar 2021 12:32:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D820E6B0072; Mon, 15 Mar 2021 12:32:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0064.hostedemail.com [216.40.44.64]) by kanga.kvack.org (Postfix) with ESMTP id BCA386B0070 for ; Mon, 15 Mar 2021 12:32:40 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 79A218249980 for ; Mon, 15 Mar 2021 16:32:40 +0000 (UTC) X-FDA: 77922652080.10.D91B7C1 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf25.hostedemail.com (Postfix) with ESMTP id BFA3960D3446 for ; Mon, 15 Mar 2021 15:58:40 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1615823914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S1QyVKaSB8Yw5ODdqZSJJFR0A2j33an6mNYtE7mQyMI=; b=DzMFy86fpC0NliOMOn+TLBRnx2vAXvuYsfAytAevIQcYeOJThvqXU/EWqRTQijA2PbPf5u Sfej+/GbLTBq7vbacY/++OH3rcXiiXi6UHEeQIb8LVTDFWexz7tRhkJKu/sk+RhAPHU8/R RgwVgISDX5ikFoETUaJNN+j2EU8Dvg4= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EE765AC75; Mon, 15 Mar 2021 15:58:33 +0000 (UTC) Date: Mon, 15 Mar 2021 16:58:32 +0100 From: Michal Hocko To: Shakeel Butt Cc: Borislav Petkov , Vasily Averin , Cgroups , Linux MM , Johannes Weiner , Vladimir Davydov , Thomas Gleixner , Ingo Molnar , x86@kernel.org Subject: Re: [PATCH v2 8/8] memcg: accounting for ldt_struct objects Message-ID: References: <360b4c94-8713-f621-1049-6bc0865c1867@virtuozzo.com> <20210315132740.GB20497@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: xx3yuaxygsjrwxwyzei3d1py4ott1h8t X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: BFA3960D3446 Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf25; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615823920-314574 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon 15-03-21 08:48:26, Shakeel Butt wrote: > On Mon, Mar 15, 2021 at 6:27 AM Borislav Petkov wrote: > > > > On Mon, Mar 15, 2021 at 03:24:01PM +0300, Vasily Averin wrote: > > > Unprivileged user inside memcg-limited container can create > > > non-accounted multi-page per-thread kernel objects for LDT > > > > I have hard time parsing this commit message. > > > > And I'm CCed only on patch 8 of what looks like a patchset. > > > > And that patchset is not on lkml so I can't find the rest to read about > > it, perhaps linux-mm. > > > > /me goes and finds it on lore > > > > I can see some bits and pieces, this, for example: > > > > https://lore.kernel.org/linux-mm/05c448c7-d992-8d80-b423-b80bf5446d7c@virtuozzo.com/ > > > > ( Btw, that version has your SOB and this patch doesn't even have a > > Signed-off-by. Next time, run your whole set through checkpatch please > > before sending. ) > > > > Now, this URL above talks about OOM, ok, that gets me close to the "why" > > this patch. > > > > From a quick look at the ldt.c code, we allow a single LDT struct per > > mm. Manpage says so too: > > > > DESCRIPTION > > modify_ldt() reads or writes the local descriptor table (LDT) for a process. > > The LDT is an array of segment descriptors that can be referenced by user code. > > Linux allows processes to configure a per-process (actually per-mm) LDT. > > > > We allow > > > > /* Maximum number of LDT entries supported. */ > > #define LDT_ENTRIES 8192 > > > > so there's an upper limit per mm. > > > > Now, please explain what is this accounting for? > > > > Let me try to provide the reasoning at least from my perspective. > There are legitimate workloads with hundreds of processes and there > can be hundreds of workloads running on large machines. The > unaccounted memory can cause isolation issues between the workloads > particularly on highly utilized machines. It would be better to be explicit 8192 * 8 = 64kB * number_of_tasks so realistically this is in range of lower megabytes. Is this worth the memcg accounting overhead? Maybe yes but what kind of workloads really care? -- Michal Hocko SUSE Labs