Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4176216pxy; Mon, 26 Apr 2021 21:13:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs336lgXeZ3CPllNt8LEL16GGZK1LEoqaKEZN/435mqLhPRUQwPFLDaK5WAFtD02KJu09C X-Received: by 2002:a63:f657:: with SMTP id u23mr20258681pgj.304.1619496799019; Mon, 26 Apr 2021 21:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619496799; cv=none; d=google.com; s=arc-20160816; b=wgMTLpZKWLDSr+Cq5ZMMjH5UtUmjwSIo4JEV4bWsCRwrVgkzOl1EJ/0zXyvflroMbI cZF6lrsyOmWFx5lhXZz729rTa58xT/zTCCsJAYC21gy616G16vV+5zsf9PYiyKLlPL2T PK/bkldbA2Hc44LBgCrX7pj1n3DMdB3TwhPNEsXKrf/bkmmMXGhqil2TiscX6qnnkrBB IMTWXbY8bIYiyc84gXjkpQyqPgQ1xnhu9eirFXNCgvVPvlEci13SbDTBs29iS00qnAkB 041lqS70uebpiKNaWp5JfaKlWRtcPHHOjXvUo8jefzFnVTBJkBFF6POEcHxe7zpk/tSV 76qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=xSbYF6YmB+6Po+HsrmYDOpI6TtqeP+AMbaRD22AzlKI=; b=wPLev0bitmPSJ4YcPm26os72LNj3kHW0QVflivb9hB2UGzjrYT7tgmvR8TTDVoUcSo 90r2JxOawrnhn71S7BdGV5POSBCRfylLU1y0KB9y+pNsya/M+SwETm0Er58LAegqxRxJ Pb+4Msw6BwpAvMLu/FehduQ3mZBF6Sm1A3OVy4aa0WRfuV6SFS/m3jsNN5/ua1jK6Pd9 +5TkWx8nQA4EF6APE1FKJQvoxEnGijYQwjVVb4ze7FUolunvoeoLYVVJISC0j8G8gBn2 +q3vpUa3fX+hEb2+8Qw4blGExVv9hJ4yk/vvpf1uYhy6wiaqd3HH5baAvHA+ZPVszx7P Js1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iO53A6Zb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o34si25401321pgm.528.2021.04.26.21.12.53; Mon, 26 Apr 2021 21:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iO53A6Zb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234707AbhD0EMh (ORCPT + 99 others); Tue, 27 Apr 2021 00:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232157AbhD0EMa (ORCPT ); Tue, 27 Apr 2021 00:12:30 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 811ECC061574 for ; Mon, 26 Apr 2021 21:11:45 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id w9so7749800lfr.12 for ; Mon, 26 Apr 2021 21:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xSbYF6YmB+6Po+HsrmYDOpI6TtqeP+AMbaRD22AzlKI=; b=iO53A6Zb7PcYh/T3a3JH5aBVwk/mWU8zPtZ8LHjq9CDwqrY+wgUIAUI6GCtNGett3a 9YOBhkdQdORaqDS3iFyB3RMzMUmhtr2omR3et0XpSA/u3QFySPS5NAea3FD+yBBJfPAz XQjxXHd2nMnStBxUsFB3oG8sFNsxdXB79p7s+A7Swiov76ZdY19a2qVwLWKbrX59bmcG D/u4diG6TLNnEeBncOIyM/khN/IsvyFRC+hiFBsuNTySOj+dZFhuI2DIQAkc1mt7nkFZ NnXMW58mxx50adoY8y2IfFS9jD95YBPJlWezY4lEwImRbZwptzfRBpuSoY6k1auXMGEu rTGA== 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=xSbYF6YmB+6Po+HsrmYDOpI6TtqeP+AMbaRD22AzlKI=; b=WBA+Uac9+b2KGvt/v7U34GeJNzem9obZg0001buir+fwb+R4hwFhAffZVB/oqCfxvk KcI5u3MHDHI9msVtRYHcn384ZootOz4DHimNCrTII03F4r+9dx3YWN7D9rJi8E1+Mq6C fEs/imOhOSIvHG7xWH0xdQw6PQSLxU4Lv8cX+ikZx70GxPGTnf8tTT03WOOFWj+Swupx Y7Fo/8VzSFFUli8SH2QPlJCqfzSDPVnVknXm37z82HSrCpn3ar3WhsfwTjlyM/0Ociov IyYwT6JzKGyc3FGNgpKSiTsGWjcw26IFrVCj0va6TtD6A1k8QnMkvN/8IXr8I8AXFwr4 AkxQ== X-Gm-Message-State: AOAM531OpvTlY8f7vM2OPwO3zx+yPrYqlGDaiK1S/xznOJrSF667uv/U x+vesVlmlRJpv2tfzBk1wKl4Zsgl9KgMEhZ/aY8= X-Received: by 2002:ac2:5042:: with SMTP id a2mr14687807lfm.650.1619496703957; Mon, 26 Apr 2021 21:11:43 -0700 (PDT) MIME-Version: 1.0 References: <1619491400-1904-1-git-send-email-sxwjean@me.com> <20210427025358.GV235567@casper.infradead.org> <20210427033632.GW235567@casper.infradead.org> In-Reply-To: <20210427033632.GW235567@casper.infradead.org> From: Xiongwei Song Date: Tue, 27 Apr 2021 12:11:17 +0800 Message-ID: Subject: Re: [PATCH] mm: append __GFP_COMP flag for trace_malloc To: Matthew Wilcox 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 27, 2021 at 11:36 AM Matthew Wilcox wrote: > > 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. I understand you. But I don't think our process needs this size. This size may be a bug in our code or somewhere, I don't know the RC for now. > [*] 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. > I just wanted to save some time when debugging. Regards