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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 09D11C433ED for ; Tue, 27 Apr 2021 03:37:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6F126613AB for ; Tue, 27 Apr 2021 03:37:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F126613AB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 03E806B0036; Mon, 26 Apr 2021 23:37:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F2FCE6B006E; Mon, 26 Apr 2021 23:36:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA9C16B0070; Mon, 26 Apr 2021 23:36:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id B6D426B0036 for ; Mon, 26 Apr 2021 23:36:59 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 52DAE181AF5D7 for ; Tue, 27 Apr 2021 03:36:59 +0000 (UTC) X-FDA: 78076735758.22.59CD8E6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id 36C06A0003A2 for ; Tue, 27 Apr 2021 03:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ANnb4BwdsJgmq/ngwPXPAcMleywCXQ3VIzlu/GWL+j8=; b=YbE8TFo8bThfJ9RPb+iSuOjGVQ ORpBqVTGkE+DtxIy43Gj78IGNx2o5/o2sVIV6/IP9LlNNsqnw34sirZi5JAgoQTC/yOe6DD/1wa4+ emRFw+I8JUng9GOPCN8Vav00R0XuHrnNae/yqXWbPC5GHlfxVjYLW/F+/Pl5BPf+liqA0Rc45ieRK ikg4H1ETqI7k4uZpt6ik0X2YppSzkRpGzv9m+1DxIjDV4bi/4UwDzr8+LkfhspfGveOEQdKUTHZsq OtUTRyVr6JLdgVupdefQ9utV17Ribe8tBrpr+jxtCgkCDHM+cQAu/bLxtuzbv1+NwaCx0T73PSs51 nN88gaYA==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lbEWW-006QLu-T6; Tue, 27 Apr 2021 03:36:38 +0000 Date: Tue, 27 Apr 2021 04:36:32 +0100 From: Matthew Wilcox To: Xiongwei Song Cc: Xiongwei Song , cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, linux-mm@kvack.org, Linux Kernel Mailing List Subject: Re: [PATCH] mm: append __GFP_COMP flag for trace_malloc Message-ID: <20210427033632.GW235567@casper.infradead.org> References: <1619491400-1904-1-git-send-email-sxwjean@me.com> <20210427025358.GV235567@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: e77u8f3dshyf3sk6rikph3xpmwmahkub X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 36C06A0003A2 Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1619494615-917953 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 Tue, Apr 27, 2021 at 11:29:32AM +0800, Xiongwei Song wrote: > On Tue, Apr 27, 2021 at 10:54 AM Matthew Wilcox wrote: > > > > On Tue, Apr 27, 2021 at 10:43:20AM +0800, Xiongwei Song wrote: > > > From: Xiongwei Song > > > > > > When calling kmalloc_order, the flags should include __GFP_COMP here, > > > so that trace_malloc can trace the precise flags. > > > > I suppose that depends on your point of view. > Correct. > > Should we report the > > flags used by the caller, or the flags that we used to allocate memory? > > And why does it matter? > When I capture kmem:kmalloc events on my env with perf: > (perf record -p my_pid -e kmem:kmalloc) > I got the result below: > 0.08% call_site=ffffffff851d0cb0 ptr=0xffff8c04a4ca0000 > bytes_req=10176 bytes_alloc=16384 > gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC Hmm ... if you have a lot of allocations about this size, that would argue in favour of adding a kmem_cache of 10880 [*] bytes. That way, we'd get 3 allocations per 32kB instead of 2. [*] 32768 / 3, rounded down to a 64 byte cacheline But I don't understand why this confused you. Your caller at ffffffff851d0cb0 didn't specify __GFP_COMP. I'd be more confused if this did report __GFP_COMP.