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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 A9F27C4361B for ; Wed, 9 Dec 2020 18:15:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1F6E623C1A for ; Wed, 9 Dec 2020 18:15:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F6E623C1A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 825398D0033; Wed, 9 Dec 2020 13:15:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FC008D0031; Wed, 9 Dec 2020 13:15:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7390D8D0033; Wed, 9 Dec 2020 13:15:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0092.hostedemail.com [216.40.44.92]) by kanga.kvack.org (Postfix) with ESMTP id 5CBB78D0031 for ; Wed, 9 Dec 2020 13:15:42 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1A3E91EE6 for ; Wed, 9 Dec 2020 18:15:42 +0000 (UTC) X-FDA: 77574546924.25.knot89_0602ace273f1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id DFE641804E3A9 for ; Wed, 9 Dec 2020 18:15:41 +0000 (UTC) X-HE-Tag: knot89_0602ace273f1 X-Filterd-Recvd-Size: 4965 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Dec 2020 18:15:39 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id s11so3519446ljp.4 for ; Wed, 09 Dec 2020 10:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KluCAXOoeTByOW4lbF1nsTzKouIPlFqCCzlWQb43QOg=; b=G1DWLyDpSMpgCLWxke7kh+OuNepikj8P4XS/mbzBAYlG01dvOyMfqZPnbeX75tqdPS rA7X9Q7otSrrcbsP4jK3fBD2ZFjV6oEzUjHS8u6ebS2/aJBNVPGkIoA9myOR9SxGflxD gsSjbHG8/8IjiKaKQ4Opa0NNUtJanvAX6pObWjcnFsH8uxumt8qOhtMTu7BFi81O2FOB 174ye8QXtiFhF7PIcxA4KC1X4D/7CR9JCKDwHuqXxOJ1vJmktzhHxyX79uVABxGrdCDc 3DAVdRUxxz8IG2MwQqGDf+aIa5BnVgBRtrWAyZ6JC6JHIubX33hxb0cx/mz6NRHmutEN IWZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KluCAXOoeTByOW4lbF1nsTzKouIPlFqCCzlWQb43QOg=; b=dbZHY8GwzSztf1qwu0kJtpopBKnFnwwjCzKGJO9/r4aSTuSa0bPmUOYc40rlrrBW4Z RINrGIdxXhO/c9iSWBnmNCiDdLlVBl6wLj854X13kWAde+n8tQ4Z/z6YT4GWfg5dbCJt oZeQ+HOVwHljxO+/Ywnw5XdAhSWK5aIRG2FPs8cQOs1iCMVRwnqxtnJCJ8umnEzu0d0y lkFwNebg7c6xh3BZ5/B/F5nB/EQXU8ZbEhckYWC4GECAOTRCqbIkv9bEOx/nggY4P0j1 BPGyI+u9AVvbiZGItYMCew3iT33rfNHNy2WO8t6u/D/NRT5vIzbX2ScN3xmUefN4CIXW vtDQ== X-Gm-Message-State: AOAM532Avvub67VkolSLmKqyKJTOkMpRLOdzANqC450/30lHFYQwiGKP cv8p482R6qfNC1/ynRTi1p2VVv7wj9MSLlNQ0UgcQg== X-Google-Smtp-Source: ABdhPJwytoCPwmwAMxFotUSDq6urZ308NhRwONKnwMRqCKVi1Qfyo/IQNkR8v/jXrjQhxtgu3/SrVUzfGE68GQnAZ70= X-Received: by 2002:a2e:975a:: with SMTP id f26mr1576542ljj.81.1607537736484; Wed, 09 Dec 2020 10:15:36 -0800 (PST) MIME-Version: 1.0 References: <20201207142204.GA18516@rlk> <20201208060747.GA56968@rlk> <20201209162935.GD26090@dhcp22.suse.cz> In-Reply-To: <20201209162935.GD26090@dhcp22.suse.cz> From: Shakeel Butt Date: Wed, 9 Dec 2020 10:15:25 -0800 Message-ID: Subject: Re: [PATCH] mm/page_alloc: simplify kmem cgroup charge/uncharge code To: Michal Hocko Cc: Hui Su , LKML , Linux MM , Andrew Morton Content-Type: text/plain; charset="UTF-8" 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 Wed, Dec 9, 2020 at 8:29 AM Michal Hocko wrote: > > On Tue 08-12-20 09:12:23, Shakeel Butt wrote: > > +Michal Hocko > > > > Message starts at https://lkml.kernel.org/r/20201207142204.GA18516@rlk > > > > On Mon, Dec 7, 2020 at 10:08 PM Hui Su wrote: > > > > > > On Mon, Dec 07, 2020 at 09:28:46AM -0800, Shakeel Butt wrote: > > > > On Mon, Dec 7, 2020 at 6:22 AM Hui Su wrote: > > > > > > > > The reason to keep __memcg_kmem_[un]charge_page functions is that they > > > > were called in the very hot path. Can you please check the performance > > > > impact of your change and if the generated code is actually same or > > > > different. > > > > > > Hi, Shakeel: > > > > > > I objdump the mm/page_alloc.o and comapre them, it change the assemble code > > > indeed. In fact, it change some code order, which i personally think won't have > > > impact on performance. And i ran the ltp mm and conatiner test, it seems nothing > > > abnormal. > > > > Did you run the tests in a memcg? The change is behind a static key of > > kmem accounting which is enabled for subcontainers. > > > > > > > > BUT i still want to check whether this change will have negative impact on > > > perforance due to this change code was called in the very hot path like you > > > said, AND saddly i did not find a way to quantify the impact on performance. > > > Can you give me some suggestion about how to quantify the performance or some > > > tool? > > > > > > > At least I think we can try with a simple page allocation in a loop > > i.e. alloc_page(GFP_KERNEL_ACCOUNT). I will think of any existing > > benchmark which exercises this code path. > > > > Michal, do you have any suggestions? > > I have to say I do not see any big benefit from the patch and it alters > a real hot path to check for the flag even in cases where kmem > accounting is not enabled, unless I am misreading the code. > Yes you are right unless the super intelligent compiler re-arranges the checks and puts the static key check at front to optimize the non-kmem-accounting mode.