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=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 A9A7DC56201 for ; Tue, 27 Oct 2020 09:10:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0F03222258 for ; Tue, 27 Oct 2020 09:10:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VaVEfgDK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F03222258 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 63B736B006C; Tue, 27 Oct 2020 05:10:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EAE36B006E; Tue, 27 Oct 2020 05:10:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B43D6B0070; Tue, 27 Oct 2020 05:10:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id 1F36E6B006C for ; Tue, 27 Oct 2020 05:10:50 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9CEA81DE0 for ; Tue, 27 Oct 2020 09:10:49 +0000 (UTC) X-FDA: 77417135418.21.leaf39_5a10bf42727a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 70E67180442C4 for ; Tue, 27 Oct 2020 09:10:49 +0000 (UTC) X-HE-Tag: leaf39_5a10bf42727a X-Filterd-Recvd-Size: 3351 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Tue, 27 Oct 2020 09:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603789848; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i7NxN+I+syqbzG1V104q5VuskMuq+vggAGJ9GCoeDg8=; b=VaVEfgDKhR14GvzIEZx7HxBU2aMfbvxJP9T2WTc1Ra0mobSMyettvm/5Cb/9uZ7z0ZVDWp Dh4ezpk75RJYVa6ZpK/rp9mfEmDpvpXFdBluQPhc/L+2LlqcHywbNRmop10pPb3fvyC81o jW+pIRqYf290Zv+/bKqB+97gxmmT2y4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-oTfVcj5LM9aJ9bkOmwGX8g-1; Tue, 27 Oct 2020 05:10:44 -0400 X-MC-Unique: oTfVcj5LM9aJ9bkOmwGX8g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AB9D71009E2D; Tue, 27 Oct 2020 09:10:42 +0000 (UTC) Received: from [10.36.113.185] (ovpn-113-185.ams2.redhat.com [10.36.113.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3140460FC2; Tue, 27 Oct 2020 09:10:41 +0000 (UTC) Subject: Re: [PATCH 3/3] mm, page_alloc: reduce static keys in prep_new_page() To: Vlastimil Babka , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Alexander Potapenko , Kees Cook , Michal Hocko , Mateusz Nosek References: <20201026173358.14704-1-vbabka@suse.cz> <20201026173358.14704-4-vbabka@suse.cz> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <93ab79df-cf8c-294b-3ed1-8a563e4a452b@redhat.com> Date: Tue, 27 Oct 2020 10:10:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20201026173358.14704-4-vbabka@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 26.10.20 18:33, Vlastimil Babka wrote: > prep_new_page() will always zero a new page (regardless of __GFP_ZERO) when > init_on_alloc is enabled, but will also always skip zeroing if the page was > already zeroed on free by init_on_free or page poisoning. > > The latter check implemented by free_pages_prezeroed() can involve two > different static keys. As prep_new_page() is really a hot path, let's introduce > a single static key free_pages_not_prezeroed for this purpose and initialize it > in init_mem_debugging(). Is this actually observable in practice? This smells like micro-optimization to me. Also, I thought the whole reason for static keys is to have basically no overhead at runtime, so I wonder if replacing two static key checks by a single one actually makes *some* difference. -- Thanks, David / dhildenb