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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 6D8D9C4338F for ; Tue, 10 Aug 2021 17:46:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C99D61390 for ; Tue, 10 Aug 2021 17:46:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0C99D61390 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3340D8D0002; Tue, 10 Aug 2021 13:46:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E43B8D0001; Tue, 10 Aug 2021 13:46:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D2F38D0002; Tue, 10 Aug 2021 13:46:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id 015818D0001 for ; Tue, 10 Aug 2021 13:46:34 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 935AC1D584 for ; Tue, 10 Aug 2021 17:46:34 +0000 (UTC) X-FDA: 78459900708.08.5E7D369 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id 04BB7600B65E for ; Tue, 10 Aug 2021 17:45:32 +0000 (UTC) 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> Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=f9X6S0jk; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 04BB7600B65E X-Stat-Signature: 3i6n6p3uzbxdqafy8jswa7jrohjabyop X-HE-Tag: 1628617532-305052 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 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.