Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp183167pxk; Tue, 22 Sep 2020 23:37:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxct57sLIuraw0eWkseFMWcFjh/dK14g7vDCSSyhkKCaNLwFk+vZGg3SuxESjRV7Z98iJ0S X-Received: by 2002:a17:906:4c4c:: with SMTP id d12mr8388501ejw.491.1600843027404; Tue, 22 Sep 2020 23:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600843027; cv=none; d=google.com; s=arc-20160816; b=BHYXY5wkvr2EcEokreHAZy8RSc1mj1oY7u+Nc8PDlL2jwULfHO1AH1UEDXY9zpjUIU lS6P0z/r1n47aE2W9PL/YFEvp6K000TC/Mlc29IF+/BccjnhSXUQ9/v7y5MD8UmiaePS pN/KyAAa/+AjxDrtB1duAl4QQMb5qwhZ+hK8/rUR9vEFvIzDT0mKcHT8L7QAVpw8taN1 Wlh6TP2VmoL8zUzJmv9AbGWYR/c/LcikYthIwj+JRW04YQM1REykqUBR0qM1FRnOSzs1 wPduUgCv6PetJPbQ3/d5MbxQFQD09UlPAobj6wDLFfb2ZMndyenfOGywJZG7NheWi6li basQ== 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=aAcU33sEyT651Bs441cN7gzu/F03SOeGyybtKcmc9Ys=; b=sfqA85/w7QF1C3rjdqHQEIL9hGacZ9RoOajcSCKEFhvMS76/0uIcD7FxZQ33KLve3x nQLd2QkhsxfLHP46dNGdGsFgCVYoxkE00mSlJnZwuMappQCGkOKCXFbT06qjCKq+wZka WsUIqkbMw4XaP5ySFUOwQ38nSvugGlU7dQ9qv4dPVmjnKFXGNQJ/vkJ1uVgPkN74RYDY xxGQcMy5Y9CpJ6p/yP88XkzHRDXNuNmOA4oPvCCSlDiTm2tG/Ciz2UUP85CdOasAQD4Z XJN4BZZ8a/fX66KTP/7OcJoFYQjNNP3oMNadTeSFfIzKtoBGe+g5TnsjuxxL+iKhrN2I ccaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=dla6zQQD; 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 u17si12382432ejj.110.2020.09.22.23.36.44; Tue, 22 Sep 2020 23:37:07 -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=dla6zQQD; 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 S1726656AbgIWGfM (ORCPT + 99 others); Wed, 23 Sep 2020 02:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726629AbgIWGfL (ORCPT ); Wed, 23 Sep 2020 02:35:11 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B391C061755 for ; Tue, 22 Sep 2020 23:35:11 -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=aAcU33sEyT651Bs441cN7gzu/F03SOeGyybtKcmc9Ys=; b=dla6zQQDgw0JL53/m4TbDgU8gz Ao7Un4pai7/CIFY8v6dOifGkde9PZs0lj5aEUqcc/CWBK5m67a8BO2o7WhvvuadO1JhB80PsqP3XZ 8R/zBKE6ZDepREYp+LCSodyCgmO82nM7q99WS986olWy3Wy40v3CNPK1DP3aN4FQyshPshcl0hF3j 7pNswzRxvrusOdDPE1GkZO62Ag5N0jFnpU0AjOfiLJi/up93jVBKdPGuSyQxiPTKFz7tzpKhYQ5Da +SRxnCW834TcZZxZDNPADi3hsOl3OzIjpupatdbIgQOBYgrMI2PtnYhbQFsMxcjhn8Gw3aqiPZP58 Xubw++QA==; Received: from hch by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKyMv-0005dm-HR; Wed, 23 Sep 2020 06:35:09 +0000 Date: Wed, 23 Sep 2020 07:35:09 +0100 From: Christoph Hellwig To: Rik van Riel Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com, niketa@fb.com, akpm@linux-foundation.org, sjenning@redhat.com, ddstreet@ieee.org, konrad.wilk@oracle.com, hannes@cmpxchg.org Subject: Re: [PATCH 2/2] mm,swap: skip swap readahead if page was obtained instantaneously Message-ID: <20200923063509.GB17027@infradead.org> References: <20200922020148.3261797-1-riel@surriel.com> <20200922020148.3261797-3-riel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922020148.3261797-3-riel@surriel.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 10:01:48PM -0400, Rik van Riel wrote: > + struct page *page; > unsigned long entry_offset = swp_offset(entry); > unsigned long offset = entry_offset; > unsigned long start_offset, end_offset; > @@ -668,11 +669,18 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, > end_offset = si->max - 1; > > blk_start_plug(&plug); > + /* If we read the page without waiting on IO, skip readahead. */ > + page = swap_cluster_read_one(entry, offset, gfp_mask, vma, addr, false); > + if (page && PageUptodate(page)) > + goto skip_unplug; > + At least for the normal block device path the plug will prevent the I/O submission from actually happening and thus PageUptodate from becoming true. I think we need to split the different code paths more cleanly. Btw, what device type and media did you test this with? What kind of numbers did you get on what workload?