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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B83B4C433F5 for ; Mon, 3 Oct 2022 10:25:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA2CA6B0072; Mon, 3 Oct 2022 06:25:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B51AC8E0002; Mon, 3 Oct 2022 06:25:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A19DA8E0001; Mon, 3 Oct 2022 06:25:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 90E406B0072 for ; Mon, 3 Oct 2022 06:25:30 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 755E4A0B86 for ; Mon, 3 Oct 2022 10:25:30 +0000 (UTC) X-FDA: 79979256420.02.9C1CC26 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf28.hostedemail.com (Postfix) with ESMTP id C5C72C0018 for ; Mon, 3 Oct 2022 10:25:29 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id g1so15880901lfu.12 for ; Mon, 03 Oct 2022 03:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=sqHXQiWfZXTSdiOfVyb8flw+WgtrLHXyasFJmUbbWdg=; b=IHrkprNGhsdefIFEF+RAkq1RClACOlBsxRtNO5uKxv+2vSZWTFv/XanwprZ4IolXqC oOsqj3PvxuCHutk/YeOk8XGZCBqwVVkWmHfc4uxoKCiziw4HVMsqYNpTQltgMZ8LnzGD 7EyMdSgCeJiswh75FzML6LEBSwyIDZU8cUXxw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=sqHXQiWfZXTSdiOfVyb8flw+WgtrLHXyasFJmUbbWdg=; b=vxYxX8hvZd5qEalXRozQF1yrIVz25o1+PcsrHh2IFxnbXZ/flKqtom6MHuPd90dFU3 niOOpmPPEmcZ6f08QByJRlkfD4UoUMvi7H76JZxn6p+kfP6ugFrbqbOqf3uJrQDrYfof PTjYr/iSfq4WaitwTeoWvYhHSfeiCnJtKkdx14Q0q/bc/GwMCc030s0SLfqr47AOnJxp qwnvKftdKA0F7UQ3G+RfnFT4WqFr2kthXi+rbRIcI7gxaSZl3LZIZs+3WuWjLIXiAUR1 NAVruQkklQWL5zi1GYhcHf346VcVKz5ZCVHrQVeZ3SiJhP5bs5J4MHV5rnMFYufWEaXR y1Zg== X-Gm-Message-State: ACrzQf1G0pH15+BHLeQmVx/nGrhUHkiG+5hNA9g8W/WtPxTDDsJpJrQw 40b33+rbE2DbRN7iiEj+/usk2A== X-Google-Smtp-Source: AMsMyM5lhaTQiE8PPSJiZ2DvZvafXUHD31zG1LikXYjBoPJeBa1n9O+tYRHhbr6329EWbbPGs5oIsQ== X-Received: by 2002:a19:4315:0:b0:497:7488:7a76 with SMTP id q21-20020a194315000000b0049774887a76mr6641072lfa.286.1664792728163; Mon, 03 Oct 2022 03:25:28 -0700 (PDT) Received: from [172.21.2.224] ([87.54.42.112]) by smtp.gmail.com with ESMTPSA id bf31-20020a2eaa1f000000b0026de3bfbbd6sm116305ljb.43.2022.10.03.03.25.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Oct 2022 03:25:27 -0700 (PDT) Message-ID: Date: Mon, 3 Oct 2022 12:25:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] mm: slub: make slab_sysfs_init() a late_initcall Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220930102712.789755-1-linux@rasmusvillemoes.dk> From: Rasmus Villemoes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664792730; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sqHXQiWfZXTSdiOfVyb8flw+WgtrLHXyasFJmUbbWdg=; b=2i6qG9xpPasbUeQOVIVqVmgRqsE2t188vJemftBba5WJAB/UhmcFuL27i1PEqlPOGddm5b htCuT4Uvv9WF+YI050kGcBX/+gGCIlL1qQ3RvGWnxoK4ywxfNpvkwSR0T3WZbSo4dOlPzw m34W9XDev650jJ3Q1iOLzaqe3cKZYkU= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=rasmusvillemoes.dk header.s=google header.b=IHrkprNG; spf=pass (imf28.hostedemail.com: domain of linux@rasmusvillemoes.dk designates 209.85.167.50 as permitted sender) smtp.mailfrom=linux@rasmusvillemoes.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664792730; a=rsa-sha256; cv=none; b=QjDDxC+ihPqRH+o53hSG0xUOw1d3H/oqTh2eJ7Iu62om6dhtnSvVBe8gaHjCWODNbGnMzb MGCwlrA3+wCCPQViqoXd7waiDNNK3s8SGC75fkWwSu3JcD/QhdCdAogs+qWDlrnxuudQyl aSiab5DF27ljmyb4jpI0gaZdGezeqVc= X-Stat-Signature: qjannubn8ma71x3yfxjka6wr1xa6gwht X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C5C72C0018 Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=rasmusvillemoes.dk header.s=google header.b=IHrkprNG; spf=pass (imf28.hostedemail.com: domain of linux@rasmusvillemoes.dk designates 209.85.167.50 as permitted sender) smtp.mailfrom=linux@rasmusvillemoes.dk; dmarc=none X-Rspam-User: X-HE-Tag: 1664792729-364260 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 03/10/2022 10.17, Hyeonggon Yoo wrote: > On Fri, Sep 30, 2022 at 12:27:12PM +0200, Rasmus Villemoes wrote: >> Currently, slab_sysfs_init() is an __initcall aka device_initcall. It >> is rather time-consuming; on my board it takes around 11ms. That's >> about 1% of the time budget I have from U-Boot letting go and until >> linux must assume responsibility of keeping the external watchdog >> happy. >> >> There's no particular reason this would need to run at device_initcall >> time, so instead make it a late_initcall to allow vital functionality >> to get started a bit sooner. >> >> This actually ends up winning more than just those 11ms, because the >> slab caches that get created during other device_initcalls (and before >> my watchdog device gets probed) now don't end up doing the somewhat >> expensive sysfs_slab_add() themselves. Some example lines (with >> initcall_debug set) before/after: >> >> initcall ext4_init_fs+0x0/0x1ac returned 0 after 1386 usecs >> initcall journal_init+0x0/0x138 returned 0 after 517 usecs >> initcall init_fat_fs+0x0/0x68 returned 0 after 294 usecs >> >> initcall ext4_init_fs+0x0/0x1ac returned 0 after 240 usecs >> initcall journal_init+0x0/0x138 returned 0 after 32 usecs >> initcall init_fat_fs+0x0/0x68 returned 0 after 18 usecs >> >> Altogether, this means I now get to petting the watchdog around 17ms >> sooner. [Of course, the time the other initcalls save is instead spent >> in slab_sysfs_init(), which goes from 11ms to 16ms, so there's no >> overall change in boot time.] > > This looks okay and just curious, > can you explain what kind of benefit does enabling watchdog early provides? The watchdog is _always_ enabled, from power-on onwards. There's nothing one can do to disable it (short of using a soldering iron to modify the board...), and usually nothing one can do to program its timeout [if it is at all configurable, it's done during board design using appropriate resistor/capacitor values]. All the custom boards I've met, across the very different industries I've worked with, have always had such an external watchdog. Their timing requirements may vary; currently I'm working on a board which has a 1s margin, but I've also encountered something as low as (IIRC) 400ms. While 10-20ms may not sound impressive, this is not the first nor the last patch I'm trying to get upstream (see e7cb072eb988 for another example, done in connection with another project) to gain as much margin as possible - we want to be able to continue to upgrade our kernels for the next 5, 10, 20 years, and undoubtedly the mainline kernel will grow features and overhead in that timespan which won't be offset by better compilers. Rasmus