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.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 B0A6CC4647B for ; Thu, 4 Jul 2019 13:00:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 889EA2189E for ; Thu, 4 Jul 2019 13:00:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E3JZ9ogc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727271AbfGDNAG (ORCPT ); Thu, 4 Jul 2019 09:00:06 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37448 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbfGDNAG (ORCPT ); Thu, 4 Jul 2019 09:00:06 -0400 Received: by mail-ed1-f66.google.com with SMTP id w13so5366035eds.4; Thu, 04 Jul 2019 06:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=W3YX4qyiQ8io0QlAlJhhQ1BpPb12I9CxfxqXtbQ0TLk=; b=E3JZ9ogcwZlSvahnLgdA879/a0BsQcwPHH8vTp1K3ZWV/6I7UECgSepeJxMFSdGRtg gKLM/46akrIUDBGrhZvZyVB9uCmyyK53zrTd2seYk7/zWRwSesJl3dD2cor46695IDfd sk6F0r8vJ2WiV53oqyU0ecCX6mh8yaCMltvd+oMts+ccs/hHClYdLKBWKBhBRZ6dv+Y1 sK23uPIZUQ0jPFIyUIicscj90bg8F70bxeuaugKdC1vC/WrOM79YujMTmmBlp5bqVVQS 0dnbKogj+GCwz60Ok3miQDyMjnm9n49s58WLI7UrJ71L25mrumXbsypWphmqfP6vGxDq arJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=W3YX4qyiQ8io0QlAlJhhQ1BpPb12I9CxfxqXtbQ0TLk=; b=IHecRWqpT5hR+6xIMwQVYt2qE/BfmkN4gAL0YWXAqW9UQpGAi4qhj5MpPAXSgamYxd 71N+9384YrfZEktzsXW+lKsc9VnupGZ6EJqoCNWvCLU3JXj9DZwEj1ZYdn30b9gwZzQv HlLV7pdnZBSVZ+g/tD+8P+QZBKtGx5pMTSgO397UGz8kuJwcDMruF3V7OVMJ3TewFqjQ dMAPfleZQjp6oP1CLf/S1FyDBycusIVjIeoGGRLH3OYU5/dxRTf1OjuZQqaNur09xNyc doQ9jwS9krpRgizhIE6+6cZgMdM4OZLNeHyoAhHh8vS5i5pZOE120xzZlZN3PAK7GGqX mIKQ== X-Gm-Message-State: APjAAAV02hFbq12S5906KxadORsp/v58TLNOzjwOgdTQW7pNC8DrJRy8 HX/Mf2DSJcX0d6U9Y2j8s3nK4Jl4 X-Google-Smtp-Source: APXvYqx/xDpW63P0DtWVWg5EHGUMTzL2ZtFT2OlGJ9vaEeS2E3Ny8vNG//RYrRCWQ9JPOE/XXajuDQ== X-Received: by 2002:a17:906:d7ab:: with SMTP id pk11mr39519655ejb.216.1562245204270; Thu, 04 Jul 2019 06:00:04 -0700 (PDT) Received: from [10.68.217.182] ([217.70.211.18]) by smtp.gmail.com with ESMTPSA id z12sm1595238edq.57.2019.07.04.06.00.02 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jul 2019 06:00:03 -0700 (PDT) Subject: Re: [PATCH] dax: Fix missed PMD wakeups To: Matthew Wilcox , Dan Williams Cc: linux-fsdevel , Jan Kara , stable , Robert Barror , Seema Pandit , linux-nvdimm , Linux Kernel Mailing List References: <156213869409.3910140.7715747316991468148.stgit@dwillia2-desk3.amr.corp.intel.com> <20190703121743.GH1729@bombadil.infradead.org> <20190703195302.GJ1729@bombadil.infradead.org> <20190704032728.GK1729@bombadil.infradead.org> From: Boaz Harrosh Message-ID: Date: Thu, 4 Jul 2019 16:00:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190704032728.GK1729@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-MW Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/07/2019 06:27, Matthew Wilcox wrote: > On Wed, Jul 03, 2019 at 02:28:41PM -0700, Dan Williams wrote: <> >>> +#ifdef CONFIG_XARRAY_MULTI >>> + unsigned int sibs = xas->xa_sibs; >>> + >>> + while (sibs) { >>> + order++; >>> + sibs /= 2; >>> + } >> >> Use ilog2() here? > > Thought about it. sibs is never going to be more than 31, so I don't > know that it's worth eliminating 5 add/shift pairs in favour of whatever > the ilog2 instruction is on a given CPU. In practice, on x86, sibs is > going to be either 0 (PTEs) or 7 (PMDs). We could also avoid even having > this function by passing PMD_ORDER or PTE_ORDER into get_unlocked_entry(). > > It's probably never going to be noticable in this scenario because it's > the very last thing checked before we put ourselves on a waitqueue and > go to sleep. > Matthew you must be kidding an ilog2 in binary is zero clocks (Return the highest bit or something like that) In any way. It took me 5 minutes to understand what you are doing here. And I only fully got it when Dan gave his comment. So please for the sake of stupid guys like me could you please make it ilog2() so to make it easier to understand? (And please don't do the compiler's job. If in some arch the loop is the fastest let the compiler decide?) Thanks Boaz