Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp335970pxb; Thu, 31 Mar 2022 06:38:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB4N8vRGbQrvbX6BdQrDpC7KtR1n/8I5i9b21+DT8a3WU62eSnaz/MyYWEaY42N4S8FbBE X-Received: by 2002:a17:90b:1e4b:b0:1c6:edfe:70ad with SMTP id pi11-20020a17090b1e4b00b001c6edfe70admr6271213pjb.198.1648733885462; Thu, 31 Mar 2022 06:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648733885; cv=none; d=google.com; s=arc-20160816; b=UkcE+fGOqJ5dVMRLBFlPh2wNZFc8LXkvb74C31+y76FtPYlXKVyhSjkIMyqdBO8sAz Z5SlGEzeilpXaJacXrkPKEmin6RlKpX5PSoy74tYNK4q/9TliBRQPU3Q9sNyYnappCi8 jN72zwrPRj1U2tBgDNMgXqvf1sM+BRnL8nEBUSQNUbMsmHhOU26oPIHyvqzyXMl4LZrV MiIDrN1dJIU1X4jV5AHfRjgW06+QBZhnIeaoqC9Fcfugcqxzt0I/8vxvbSInC0zuSnyv a6HaYk6Wuf83ks0zYei9SoPBq5BOf0iDqOVyWQGMKeOf3Fnt96KW/wPgFhcNdP7r81eH 61oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=lp1+z0UHqRBDQ+sLPkTp3tKdME/FzQin9HL9N1Ymm6E=; b=SsTJCdwGk087UxZG9KWHbAMQkB3uW4jwAwnwOT/wwZkM8Gk08wrwQMD1rYIQ5H/m8X dsiR0FmIJG1eKy4c8F9QwuC7iYEaikzWhJvTTPACAoEVUga836oDrHkj1kF4HmWV+s2c ntLYdtVkH5s3IGUpsQxHGHwmueCaAgrFwdoCoS3zstme+Wh+sjZIMdzSmy6xlf/5ZaC+ +883gw2RbBvUdEh25Xf3Eln8mlzsI3peMz7gUgKw4Py09R+P/Sz4WGOmjyVevQJKcQAi YJTjSqvj2R9gqdyeIhfzmYg6vfwpsTWfJR+io5Q2Y43hUJD6YdQFbaU6DllsQhXIieq2 LQ7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a23-20020a62e217000000b004fa3a8e006dsi22747270pfi.292.2022.03.31.06.37.28; Thu, 31 Mar 2022 06:38:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232152AbiCaIzq (ORCPT + 99 others); Thu, 31 Mar 2022 04:55:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230375AbiCaIzp (ORCPT ); Thu, 31 Mar 2022 04:55:45 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF910996AF; Thu, 31 Mar 2022 01:53:47 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 2E81268AA6; Thu, 31 Mar 2022 10:53:42 +0200 (CEST) Date: Thu, 31 Mar 2022 10:53:41 +0200 From: Christoph Hellwig To: Alex Sierra Cc: jgg@nvidia.com, david@redhat.com, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jglisse@redhat.com, apopple@nvidia.com, willy@infradead.org, akpm@linux-foundation.org Subject: Re: [PATCH v2 1/3] mm: add vm_normal_lru_pages for LRU handled pages only Message-ID: <20220331085341.GA22102@lst.de> References: <20220330212537.12186-1-alex.sierra@amd.com> <20220330212537.12186-2-alex.sierra@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220330212537.12186-2-alex.sierra@amd.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org > - page = vm_normal_page(vma, addr, pte); > + page = vm_normal_lru_page(vma, addr, pte); Why can't this deal with ZONE_DEVICE pages? It certainly has nothing do with a LRU I think. In fact being able to have stats that count say the number of device pages here would probably be useful at some point. In general I find the vm_normal_lru_page vs vm_normal_page API highly confusing. An explicit check for zone device pages in the dozen or so spots that care has a much better documentation value, especially if accompanied by comments where it isn't entirely obvious. > page = follow_page(vma, addr, > - FOLL_GET | FOLL_MIGRATION | FOLL_REMOTE); > + FOLL_GET | FOLL_MIGRATION | FOLL_REMOTE | FOLL_LRU); Overly long line here. > +/* > + * NOTE: Technically this should goto check_pfn label. However, page->_mapcount > + * is never incremented for device pages that are mmap through DAX mechanism > + * using pmem driver mounted into ext4 filesystem. When these pages are unmap, > + * zap_pte_range is called and vm_normal_page return a valid page with > + * page_mapcount() = 0, before page_remove_rmap is called. > + */ Please properly indent comments. > + * zone, as long as the pte's are present and vm_normal_lru_page() succeeds. These > * pages also get pinned. Another overly long line here.