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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 6E728C2B9F8 for ; Tue, 25 May 2021 07:27:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 506EE613FA for ; Tue, 25 May 2021 07:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231594AbhEYH2c (ORCPT ); Tue, 25 May 2021 03:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230005AbhEYH2c (ORCPT ); Tue, 25 May 2021 03:28:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB2EC061574 for ; Tue, 25 May 2021 00:27:03 -0700 (PDT) Date: Tue, 25 May 2021 09:26:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621927620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0MuTplG8MOBaTciGrRTlbCRSKTNy9maUaomtFzX8Yqw=; b=QehdDliCJrQjnnQzPlKrvwzJMshveidMnlGVerKX8m7XWqq7W/GMgguL80Z8C/4I+ZGB+2 hKH9JyGuKHTUH8UnGMS9YB0TDP0MCZ5a9Ix0rXDtdqcz0JD3OcvWp7ZvflRF/Tm3hFHPYX yTMptNzJ++z/b/U+FhyrJHQ1Vs+8VtExH974dE+xuQ95yd+x6dcn62VPvfCeWOJ9WiPDKX Fus+xHveFWrJN83Xtwqj1M/ifUA7419OgXH0MbKFbyON8W8ZtlYiPs4Gizdxs5w52QbiMq mwxm1Z+7m6rABsKWlxeUtkw+vFDAY5eqidrzwATzaN6Yv8deq2XGc++E99I1tQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621927620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0MuTplG8MOBaTciGrRTlbCRSKTNy9maUaomtFzX8Yqw=; b=1BAY7gtZY4FtMcWs4W7QNqJKSlF4SFn+aNGZX83U2/Lfze3NOR7ZunRDcaDmuNSaS5sGMd v+H1sLnmCdWABfAw== From: "Ahmed S. Darwish" To: Dipen Patel Cc: linux-rt-users@vger.kernel.org Subject: Re: Multi pthreaded RT application - mlock doubt Message-ID: References: <896cf71c-f610-961a-9d30-8a82d433e0f6@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <896cf71c-f610-961a-9d30-8a82d433e0f6@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org On Wed, Mar 31, 2021 at 07:06:26PM -0700, Dipen Patel wrote: > Hi, > > I was following > https://rt.wiki.kernel.org/index.php/Threaded_RT-application_with_memory_locking_and_stack_handling_example > with some below changes: > The example above is a bit inaccurate, as it prefaults the thread's stack much later than it should be. ... > > thread_fn { > getrusage(RUSAGE_SELF, &usage);> > print and save usage.ruminflt; > prove_thread_stack_use_is_safe > getrusage(RUSAGE_SELF, &usage); > print usage.ruminflt - last_saved_cnt; > } > > I observed there are still page faults. Well, in the snippet above, there will obviously be page faults, as you're also measuring the faults generated by prove_thread_stack_use_is_safe(). On first invocation, this is actually the method prefaulting the thread stack. To make sure the discussion is more concrete, can you please send a complete, compilable, *.c file? Good luck, -- Ahmed S. Darwish Linutronix GmbH