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 B2B7AC43460 for ; Tue, 11 May 2021 05:31:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 509BA61920 for ; Tue, 11 May 2021 05:31:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 509BA61920 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 B18C86B006E; Tue, 11 May 2021 01:31:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC8746B0071; Tue, 11 May 2021 01:31:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 968356B0072; Tue, 11 May 2021 01:31:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id 7BC8E6B006E for ; Tue, 11 May 2021 01:31:54 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 394CF8249980 for ; Tue, 11 May 2021 05:31:54 +0000 (UTC) X-FDA: 78127828548.30.A1894E3 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by imf07.hostedemail.com (Postfix) with ESMTP id CE8EBA000382 for ; Tue, 11 May 2021 05:31:50 +0000 (UTC) Received: by mail-ed1-f53.google.com with SMTP id n25so21362695edr.5 for ; Mon, 10 May 2021 22:31:53 -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=dCZrRM3udZJBNFXFYYKzBZqfQzOH2s+IIGlUraUh5YE=; b=gkK9qSTRgN2c9OERNxvdGwa7fWng8sUpLFAl6LfivJoG3qvSNUWIeoWOWyOAnBlwon +nBxGW+OltHMXxDrxMYxG2ZT8veHHz71TgmRAMLczL7gfL0vivud496HTvuB1ORuBKuP OpnxG8OPfyZLyc5HJ7xJbfd88G/OC+RigjAt5Zb+ml+kviRbrxRALWCKtw4w1m2oY4AL hKEUJyi0/qs/tp1DWL4eGMja5Sdd7iA1N4hlg9DXEE6fApLElJUUTTVjZaoktP9yRjHo 708OM7o7UwXtDd82sJj2PoYTFPwjgaJLllhdqs9mODFbnaQ8yP9gR3D8FxDa763UN2v0 OyVw== 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=dCZrRM3udZJBNFXFYYKzBZqfQzOH2s+IIGlUraUh5YE=; b=e0zZ1DCVAZDnMo+AarQiIPbNk+iE6QIQauiUU4uhdx1RgDzYWYZKkMOeN3ASQ8gQ6t 4SQty6BA3nSoaUQJzO1fgNFggjKgv564Bl0h+BCrSF6bj5uX5k3WOabMaRiPtBl0syzw 5BXf0Df7xTaKBKC6fWH0xl0bRgzDIDJv6aq6nqf2qgeK3VH2EIsGwKX5DnAc8HTkKpm2 qCkzOYJhWZKU7ayd0l2pmTwSyOLdieFnXeV7mjR6bKqkVUFwGorn/opNlfxIObPA6c4L oXjANVDr3EJHtH/gBpFKrWJgtqo6N0TL1SSqsZokrrQow90XP70idPVQet9lkbL4h4RA U2Xg== X-Gm-Message-State: AOAM531JXIEoeKmQpl8Sga39RYWj3p+Y7sLCtoAB8TIvlYHKcurQ0mEL abiTsE47JfdtS5fLKUQ7obOI9qw88p6uokO1N9M= X-Google-Smtp-Source: ABdhPJwY+bFI/cwvXwJN8GNLnEmFFhjuly1+pfl6o0dnXuZW9UWpXoknO42mUzqS64jN78DEQmxSqCBrWNM9ILwQT40= X-Received: by 2002:aa7:d952:: with SMTP id l18mr33295592eds.83.1620711112526; Mon, 10 May 2021 22:31:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shivank Garg Date: Tue, 11 May 2021 11:01:36 +0530 Message-ID: Subject: Re: Profiling execution time for __alloc_pages_nodemask To: Yang Shi , David Hildenbrand Cc: 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: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gkK9qSTR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of shivankgarg98@gmail.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=shivankgarg98@gmail.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CE8EBA000382 X-Stat-Signature: 5ob4ixzoxryxriw5fgxfuupj1pmsw6za Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf07; identity=mailfrom; envelope-from=""; helo=mail-ed1-f53.google.com; client-ip=209.85.208.53 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620711110-644741 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: >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. 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 > >