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=-1.0 required=3.0 tests=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 E318CC433DF for ; Mon, 18 May 2020 09:13:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8C04F20643 for ; Mon, 18 May 2020 09:13:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C04F20643 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D4A90900003; Mon, 18 May 2020 05:13:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D22AB900002; Mon, 18 May 2020 05:13:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C38E3900003; Mon, 18 May 2020 05:13:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id AC5E5900002 for ; Mon, 18 May 2020 05:13:42 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6B69F180AD81D for ; Mon, 18 May 2020 09:13:42 +0000 (UTC) X-FDA: 76829277084.27.edge86_2055092815928 X-HE-Tag: edge86_2055092815928 X-Filterd-Recvd-Size: 4807 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 18 May 2020 09:13:42 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id e16so10889216wra.7 for ; Mon, 18 May 2020 02:13:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0jz6eHl43qDHTOeA1JCzvsRV/C+FflAiTtYEC302zho=; b=Pjgp6vZpNrPp+k5KokibdirjLTLcVjHrjYoS1zuzZGo12XlS4fJRH2cLzWYHIus3Pu 1LCV/GgZLuSlLyHZd4KRa5S77dAbWP/pT2tPioOzV+Rp7TuaX3agN0HHcSK6JE8MT4wX M+wnkSj2RffthofaIpQcBZGfzHGNX1krBzrcw5TNJWNM/KZl284mm+4WBZhDGKHvWis+ /aSlbXAGVI4lMaPXzbo0dhOCKlyKboMBGV4s4VrimwuduzsN42mioRY99OWXdIWE75At Mi0gaalFRcanPK6ZM3uQwzrUIxDqf6fVIAnqdGakdyFxNeF/eAtp499mADK3SoXoy612 Guqw== X-Gm-Message-State: AOAM530rfl1abkonYvO1VjTXEJy2Awka1wwrgm59VCzB4dxETy3FFdYV 9GsL0qCZhAvFzb3HxTRLIZs= X-Google-Smtp-Source: ABdhPJwfSfxfP1lzmy3Ft9wV578jV9aJ4N8b9j3zAuaeDWzaZqZo9LZ73YuFZ/td2317ZqW04jG9fA== X-Received: by 2002:a5d:4ccd:: with SMTP id c13mr19121698wrt.415.1589793221015; Mon, 18 May 2020 02:13:41 -0700 (PDT) Received: from localhost (ip-37-188-176-234.eurotel.cz. [37.188.176.234]) by smtp.gmail.com with ESMTPSA id o24sm3517098wmm.33.2020.05.18.02.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 02:13:40 -0700 (PDT) Date: Mon, 18 May 2020 11:13:38 +0200 From: Michal Hocko To: Shakeel Butt Cc: Zefan Li , Roman Gushchin , Johannes Weiner , Vladimir Davydov , Cgroups , Linux MM , Andrew Morton Subject: Re: [PATCH v2] memcg: Fix memcg_kmem_bypass() for remote memcg charging Message-ID: <20200518091338.GA32497@dhcp22.suse.cz> References: <76f71776-d049-7407-8574-86b6e9d80704@huawei.com> <20200513112905.GX29153@dhcp22.suse.cz> <3a721f62-5a66-8bc5-247b-5c8b7c51c555@huawei.com> <20200513161110.GA70427@carbon.DHCP.thefacebook.com> <20e89344-cf00-8b0c-64c3-0ac7efd601e6@huawei.com> <20200514225259.GA81563@carbon.dhcp.thefacebook.com> <20200515065645.GD29153@dhcp22.suse.cz> <20200515083458.GK29153@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Fri 15-05-20 09:22:25, Shakeel Butt wrote: > On Fri, May 15, 2020 at 1:35 AM Michal Hocko wrote: > > > > On Fri 15-05-20 16:20:04, Li Zefan wrote: > > > On 2020/5/15 14:56, Michal Hocko wrote: > > > > On Thu 14-05-20 15:52:59, Roman Gushchin wrote: > > [...] > > > >>> I thought the user should ensure not do this, but now I think it makes sense to just bypass > > > >>> the interrupt case. > > > >> > > > >> I think now it's mostly a legacy of the opt-out kernel memory accounting. > > > >> Actually we can relax this requirement by forcibly overcommit the memory cgroup > > > >> if the allocation is happening from the irq context, and punish it afterwards. > > > >> Idk how much we wanna this, hopefully nobody is allocating large non-temporarily > > > >> objects from an irq. > > > > > > > > I do not think we want to pretend that remote charging from the IRQ > > > > context is supported. Why don't we simply WARN_ON(in_interrupt()) there? > > > > > > > > > > How about: > > > > > > static inline bool memcg_kmem_bypass(void) > > > { > > > if (in_interrupt()) { > > > WARN_ON(current->active_memcg); > > > return true; > > > } > > > > Why not simply > > > > if (WARN_ON_ONCE(in_interrupt()) > > return true; > > > > the idea is that we want to catch any __GFP_ACCOUNT user from IRQ > > context because this just doesn't work and we do not plan to support it > > for now and foreseeable future. If this is reduced only to active_memcg > > then we are only getting a partial picture. > > > > There are SLAB_ACCOUNT kmem caches which do allocations in IRQ context > (see sk_prot_alloc()), so, either we make charging work in IRQ or no > warnings at all. OK, I see. I wasn't aware that those caches are used from IRQ context. -- Michal Hocko SUSE Labs