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.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 7EE6FC2B9F7 for ; Fri, 28 May 2021 13:09:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 14B766139A for ; Fri, 28 May 2021 13:09:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14B766139A 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 A7AEC6B006E; Fri, 28 May 2021 09:09:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A51206B0070; Fri, 28 May 2021 09:09:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F2D86B0071; Fri, 28 May 2021 09:09:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id 62E3B6B006E for ; Fri, 28 May 2021 09:09:04 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F3BF61802E600 for ; Fri, 28 May 2021 13:09:03 +0000 (UTC) X-FDA: 78190670208.20.9019EDF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 5E61C60002D3 for ; Fri, 28 May 2021 13:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622207343; 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=EEX/rBmiVlJyVxednzmK+k/yMHjRZkeckV9ZqXD+m/8=; b=MNyGBoh0cL4TzrI1ziwLdoGwdeTCtLUmyO//u3geKMukCjq3XtuXWjW94qI03xcdDfNyQH wUSUSbpvOu4cZseKd0bmML4GvNCf8oF7msmwOdrMI+O1+pJHHvaqhhM6blqv3bZtj8+rkl xJJuJs8fw0Rti303cfnO5/dz9Qrn+54= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-226-3nZwbRqjOliMowCgfle22A-1; Fri, 28 May 2021 09:09:01 -0400 X-MC-Unique: 3nZwbRqjOliMowCgfle22A-1 Received: by mail-ed1-f70.google.com with SMTP id w22-20020a05640234d6b029038d04376b6aso2087159edc.21 for ; Fri, 28 May 2021 06:09:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=EEX/rBmiVlJyVxednzmK+k/yMHjRZkeckV9ZqXD+m/8=; b=G4v6EqdgRTMBmWOTyiCvvU1qz3+/R7T24zwCDMd0rNy+7MLdu+kG0MPruwDgIgsP2t TdOt7qYJ9X5XFvOtIhAd0Z8k7KuT+3pCrvteWO0UJG51zBk/0EYfqVmtaAYYnG5wLhU1 rA5HUPXJ46r0tciHIiDyUeoqhp4y2uHH0oQn1LgxaX2q4ObvyK06ATksd+/YgbetlW2F 6Kn9lUQ0utOwSoeDM6TB4uGfHTAt+5WxmDV+pQwb9kaLdSpgqzeV6x4erqkFs9gkoAGe UNl9wJv0e5biPyTgkW+AqjY/Y1HXVyT8oAZsxI8Eqbhi9UTrjcUUiuUVPbg0NiTV4vsf XU4A== X-Gm-Message-State: AOAM532JZLkVYDDBjpOPENLL5/L91GNOdtTN+WiNXDy21h9n9vETBfuy vfRCEj/8hUIxpvwSoeSa656FHQMgMyAXDMHv0an5RQgVDW9JPl4i/laDoQQKU7iojVo17OAzDzd YAWbKLWj0Vm+5bSWS4YHcdHY99Es7KtUq/4cScmedPaMvtQSbwSGz3AMepcM= X-Received: by 2002:a17:906:bb0e:: with SMTP id jz14mr8813954ejb.285.1622207340327; Fri, 28 May 2021 06:09:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvtx+PlUXKNPCQkb3twdze1odjjLz+/TX1k+GLWLnk8MeS0QSt7e+7UCMbEfcmkCbx2WKBPw== X-Received: by 2002:a17:906:bb0e:: with SMTP id jz14mr8813933ejb.285.1622207340099; Fri, 28 May 2021 06:09:00 -0700 (PDT) Received: from [192.168.3.132] (p5b0c6870.dip0.t-ipconnect.de. [91.12.104.112]) by smtp.gmail.com with ESMTPSA id w14sm2742416edj.6.2021.05.28.06.08.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 May 2021 06:08:59 -0700 (PDT) To: torvic9@mailbox.org, "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" Cc: "linux-mm@kvack.org" References: <1825464932.40588.1622203733380@office.mailbox.org> From: David Hildenbrand Organization: Red Hat Subject: Re: [Question] mm/vmpressure.c: ilog2 calculation in constant Message-ID: <7a34c010-9f2a-431b-3c49-8f0d387f1cba@redhat.com> Date: Fri, 28 May 2021 15:08:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1825464932.40588.1622203733380@office.mailbox.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 5E61C60002D3 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MNyGBoh0; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf09.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam03 X-Stat-Signature: mrz5dsqexjtso58fpr63m7fn8ospjouz X-HE-Tag: 1622207338-692625 Content-Transfer-Encoding: quoted-printable 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 28.05.21 14:08, torvic9@mailbox.org wrote: > Hello, >=20 > in mm/vmpressure.c, we have defined this constant: >=20 > static const unsigned int vmpressure_level_critical_prio =3D ilog2(1= 00 / 10); >=20 > My question is: Why do we calculate ilog2 instead of simply setting the= constant to '3'? My best guess is that it's in place to a) increase readability b) make=20 it easier to adjust. The compiler will optimize it out either way, so we=20 don't really care. Having that said: it doesn't increase readability on my end. But I only=20 took a quick glimpse. Maybe the "100 / 10 =3D=3D 10" here is the magic bi= t=20 also mentioned in the comment "when scanning depth is ~10%". So it can=20 be adjusted "more easily" eventually ... at least not by me. --=20 Thanks, David / dhildenb