Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3788304pxt; Tue, 10 Aug 2021 11:18:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE7GJAtMs0a9+IFMYwh21KPfX23KTZDWZc79uswAcMdeXi1l63RlsV1Uu7LVDiBe8fBLyL X-Received: by 2002:a17:906:814b:: with SMTP id z11mr28715890ejw.204.1628619520415; Tue, 10 Aug 2021 11:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628619520; cv=none; d=google.com; s=arc-20160816; b=hznS3z3qkrEzaXlJ2b6fdF/JQ9vT3U6qDNoSAymzg9lNZJkYBKt+CaKhkdYzFb7U03 C8ruYsaV+fvK71tHzBQ6fSfLvwmfkgMOPg+AZ3BLnXBBBoS83SvRRBZDj+cLjYO9lmUI iVMzcfmJppcu1PjdLKxniX8cctVOTKefjrc7mmxNN6JxM4X7fc7lKGQVTNjb1SptT6J4 nlku4iYP8R9H0Zl+lzsNArKDO8f87KuonGzW8X0J0yWakceiXYjQcrSEQY7yYqL2gU0f WZL/leIRGzMQPpp9sCuONquer8WRxtbAwZdRbvK/Cr8cnNRfJ3GQwCRKSziP3kCwXcBp YVfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZKuxRwEJi6UdCiGa5FH7hMsus6mtsxEd3RxdDhTPJbI=; b=WfXmnPg7IMp1tZ2F41JHKyuBHfoWI4nU7bxJaR5vvvAFY148sMPHMEfgOKCdvV32ZQ 4vBSYVmBg5pjZi96wujPiZuORTqm78r8lp6Kq124ol103s/4x9PrGdGa6ya+rh6Rd7Qx 3kSoHPQZRPiINmKx0YBAWWv18cS3qgYqaZwYN8pBwDiE13c0AKEvUdSYyxYbn+3GuSUY sLkQy+i1Q96o/o5W9U/7wCZEOTGl6hTfKpZKySCZ3SXn2IPWKBaQYPrfJArHCumrIsB6 AZTX01/K8RxOBIQNS45sHFesWhcL+FbNOxPAlom7n0Ih/GOcMYDYhjNcbjaT0MfstpDK XUkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=f9X6S0jk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q5si21503622edh.490.2021.08.10.11.18.16; Tue, 10 Aug 2021 11:18:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=f9X6S0jk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236314AbhHJSRF (ORCPT + 99 others); Tue, 10 Aug 2021 14:17:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238075AbhHJSOj (ORCPT ); Tue, 10 Aug 2021 14:14:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33420C0313B2; Tue, 10 Aug 2021 10:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZKuxRwEJi6UdCiGa5FH7hMsus6mtsxEd3RxdDhTPJbI=; b=f9X6S0jkP3ygdDdCGylA9+HbRb kQBxrJmSN1t1o5T4qjzsiFzUqBPVYbYzikHjkJhqlP3oMovCy6/DlA2nilmjCJgVREPrXlxUVRPf6 ou+BhWtn/OPmrfSq7HYCqIOFNgyAZ6ElRLTfSmQCqGOgMHE8GklMwPptaTyD/aBhbdneoF8tcmMcg NIr2vNmSVrRE1MEWdnmhvTTpHW5AlBHOEwbnQnkcdxqI9Rxd+V3XpFNCXl1op0/JlI+1G9OnPNBOM 41B7uo8kyvcqcnG+HTD7M/Fuqu50fWPvbnhc17wGt76g8k/T27HZNjHFj2k5TGVOgFYQnVPFOguUt upocO09g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDVmt-00CQ4n-Cd; Tue, 10 Aug 2021 17:44:28 +0000 Date: Tue, 10 Aug 2021 18:43:39 +0100 From: Matthew Wilcox To: Vlastimil Babka Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Yu Zhao , Christoph Hellwig , David Howells , "Kirill A . Shutemov" Subject: Re: [PATCH v14 011/138] mm/lru: Add folio LRU functions Message-ID: References: <20210715033704.692967-1-willy@infradead.org> <20210715033704.692967-12-willy@infradead.org> <91fb7d5b-9f5f-855e-2c87-dab105d5c977@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91fb7d5b-9f5f-855e-2c87-dab105d5c977@suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 06:01:16PM +0200, Vlastimil Babka wrote: > Actually looking at the git version, which has also this: > > static __always_inline void update_lru_size(struct lruvec *lruvec, > enum lru_list lru, enum zone_type zid, > - int nr_pages) > + long nr_pages) > { > > Why now and here? Some of the functions called from update_lru_size() > still take int so this looks arbitrary? I'm still a little freaked out about the lack of warning for: void f(long n); void g(unsigned int n) { f(-n); } so I've decided that the count of pages in a folio is always of type long. The actual number is positive, and currently it's between 1 and 1024 (inclusive on both bounds), so it's always going to be representable in an int. Narrowing it doesn't cause a bug, so we don't need to change nr_pages anywhere, but it does no harm to make functions take a long instead of an int (it may even cause slightly better code generation, based on the sample of functions I've looked at). Maybe changing update_lru_size() in this patch is wrong. I can drop it if you like.