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=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 8E85CC433B4 for ; Wed, 12 May 2021 03:57:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DAA5A6143A for ; Wed, 12 May 2021 03:56:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAA5A6143A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5CCD96B0036; Tue, 11 May 2021 23:56:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 57C6D6B006E; Tue, 11 May 2021 23:56:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F60A6B0070; Tue, 11 May 2021 23:56:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0147.hostedemail.com [216.40.44.147]) by kanga.kvack.org (Postfix) with ESMTP id 23F4E6B0036 for ; Tue, 11 May 2021 23:56:59 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D7B28909D for ; Wed, 12 May 2021 03:56:58 +0000 (UTC) X-FDA: 78131218116.23.81E0566 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by imf22.hostedemail.com (Postfix) with ESMTP id 65529C0007EA for ; Wed, 12 May 2021 03:56:50 +0000 (UTC) Received: by mail-ej1-f53.google.com with SMTP id u21so32827761ejo.13 for ; Tue, 11 May 2021 20:56:58 -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=zlhKhG4fspgbLiu4c1/LPzDzHnSyAtjFyj5u4dh9SP4=; b=SXN4dOAPXIqLhxzVDUinSy7iB+8knc/4ohTd1UBwxqODeQs35tsI9PpQqDt0uP2WU2 P6oUJsL5PfPQiuxgCJDb7IE3tnV/2ozJtxhjMau3O9+O9aPwKTSD8OEXeKqBcUdI2MhR G11oTBwB9bksV1HEAw/AVQFuKEIQl/8Qbp5ITpKU4sECmiBSFaL2iiaO9ElFA3oqNWX6 rMw69PwMGV8zXXbRRAqXEaERX5vLyfwM9ayF5cfhrtbhvP1++vMclbqSjJFVhXlasDnH VzTXRZEfnSm+WCcqy8OLIbwgRkNZEnyotwY7gu1lcxln1q/83HaRN6Bw40wh/VRFSQzH mFQA== 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=zlhKhG4fspgbLiu4c1/LPzDzHnSyAtjFyj5u4dh9SP4=; b=S4hJg16dPuJnkkQosfZJgbIA2nlj/DB7sfkhOqtutZwJoiWlKWQy84Dl4kxTw/ZKgG z8oD8TFU8X3wkABjG58VCqCMyHx79NZ7DRlcl364jeyLxfgdnlctpCFuhdn0dKD7dWy1 3E7LTr1urds7DYYeGVPbC4EXk5I8KZ3+HpAaS+fesOMcUngaIsVjUhnWGZ1xxWazWBP5 glLl4VwXaK4+fgVTfQXRbaE/RE1Hg4b4PidB5VOS6DFP7IT46CmFIOtBHxzh1blBmwbn k+nARQ25h3Gz8D/9D/hAEFg9B5cLDQL8Fs0R3BjLmGam+iVYU/VfvKUBYA4o5kkl+NGC gmmw== X-Gm-Message-State: AOAM533UP5oFeBonvFj5dP+CeUJ0kyMUlTlqA8BP5t9mwn7gr8NlRZqL EOI+iYQVOp2q66gPl01CrmCBcZ8pFLG3vvvLFCc= X-Google-Smtp-Source: ABdhPJw2/23+165VMDXvj7TNLDo0omiX2eOVC/D+sgD16wf+j30Ffasg+v5NrPdjA0d6wKkfySYLRsV1isq5yn3h9+4= X-Received: by 2002:a17:906:a51:: with SMTP id x17mr35306357ejf.25.1620791817166; Tue, 11 May 2021 20:56:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yang Shi Date: Tue, 11 May 2021 20:56:45 -0700 Message-ID: Subject: Re: Profiling execution time for __alloc_pages_nodemask To: Shivank Garg Cc: David Hildenbrand , Linux MM , Andrew Morton , Linux Kernel Mailing List , gregkh@linuxfoundation.org, sergey.senozhatsky@gmail.com, pmladek@suse.com Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=SXN4dOAP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of shy828301@gmail.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 65529C0007EA X-Stat-Signature: 5b8hdk3dy5tuwbi4y6hspwdzdr5yb5tz Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf22; identity=mailfrom; envelope-from=""; helo=mail-ej1-f53.google.com; client-ip=209.85.218.53 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620791810-648124 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, May 10, 2021 at 10:31 PM Shivank Garg wrote: > > >Are you maybe calling ktime_get() too early during boot, where some > >subsystems are just about to be brought up? > > Thanks David, I guess this is the issue. > > >Is there any reason that prevents you from using some advanced tools, > >i.e. perf, bcc/bpftrace, etc? They are much simpler than adding > >instrumentation in kernel. > > Actually, I want to record the arguments for the memory allocator and > filter out the calls I don't need (which are creating noise). > For instance, I'm only interested in particular order and flags. BPF can do so too. You can either attach to kprobe or tracepoint, then filter out the calls by the function's parameters or tracepoint's fields. > > This is the reason I added my custom tracepoint, which theoretically > looked easy to implement without adding much overhead. > > Thanks, > Shivank > > On Tue, May 11, 2021 at 5:30 AM Yang Shi wrote: > > > > On Mon, May 10, 2021 at 7:57 AM Shivank Garg wrote: > > > > > > Hi Everyone! > > > > > > I want to profile the time taken to execute the __alloc_pages_nodemask > > > for different linux configurations/parameters. > > > To measure the execution time, I use the ktime_get() apis. I get the > > > ktime_get() on the top, and I want to do ktime_sub(ktime_get(),ktime) > > > and record it in a tracepoint. > > > However, the patch on implementation prevents the kernel from booting > > > up. I debugged the bug to find out that the issue recurs on adding > > > ktime_get() inside the __alloc_pages_nodemask path. So, that the > > > kernel fails to boot up ( and show the blank screen without any logs ) > > > I'm using the Linux kernel 5.6.13 (5821a5593fa9f28eb6fcc95c35d00454d9bb8624) > > > > Is there any reason that prevents you from using some advanced tools, > > i.e. perf, bcc/bpftrace, etc? They are much simpler than adding > > instrumentation in kernel. > > > > > > > > Is it an expected behavior? or a BUG? Has anyone else faced the same issue? > > > > > > Can you please suggest, what would be a good way to measure execution > > > time for page allocation (if not ktime_get) > > > > > > Stay Safe! > > > Best Regards, > > > Shivank Garg > > > Open-Source Enthusiast and Student, IIT Kanpur > > >