Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp159988rdf; Mon, 20 Nov 2023 21:14:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IETc+TClfvE9QEeYSTj2+bxW1oa1USqnPur0wnAscpP34d9IKVvXzIenZ6px2kYYQWxin3e X-Received: by 2002:a05:6358:e812:b0:16b:fc58:6ad with SMTP id gi18-20020a056358e81200b0016bfc5806admr6812153rwb.21.1700543667788; Mon, 20 Nov 2023 21:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700543667; cv=none; d=google.com; s=arc-20160816; b=o8JTlfrs4z2EjiHIhDxByidClLgKWsKrBKdRHsltbwpip0a2IvzAeWmxHQrkQ4D4bE cuERQOa80WpnzlJffJVJsnW6yCdwMF1wlPj6t7Kvn8g7/oQlRa5mhuon05ZFdSIfJKaQ xsX1goHCZiuPDqGscswFPemb2+WClclZ1nGSPCQjsTvTKQeH18yEaO+AtWDECwEZA9xu nRMmHaYXYgFq1tR70woYwZD3xEBw2pQWYsZs0xvKLjG63oSakbXjbfQzzI7Vuk04J+1I JY9IPxuVJCrV8xg1tjyeNIRX2TVyOejeVOzdVX7vbJ6G9KTqQItcPJfaM4AZTEgkRjig Y4vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=M5lrT4c9k4YxTqvdYYYg65ph8m38vApscNSlQybsKPw=; fh=tK6xtWWQQ7WbH1b4fbuMU+2Cmp4goAd4Oor5/a9gif8=; b=FeOmngE+eP+duyKVU5v2EazMsaAXhjEWC2F7qKO0LroB6jqmW7Eykhaf/3eNQI59Ci c2Pab5EOBQqs1c83N6Ms2LKwD8+RgbJb9J0uwq7wjuqZlO62kalbZMjXeDLCAYEGfmJ6 AcnXDKyeXZ3LQBK9eo4VLvzVHBR3kA8Bu7Uo4tMSArgnACFCrRgReGHIMXgkytScb2js MdtXGs48VFnlQD9DpmzzQ1VNkAS9ksfM6sucCU7IIRPV5PILzYEB739Qsybe/ZdrxHD9 QVbBMkVnTezBTcanTWRX3NCc4gPGuEipUxk10MO/4xo+D+slT4/pee6LrQreTWRZO3Nc QwzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RTMGDAw4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id s138-20020a632c90000000b005c1faa82c06si9067321pgs.470.2023.11.20.21.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 21:14:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RTMGDAw4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E3D09804A4D7; Mon, 20 Nov 2023 21:14:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230250AbjKUFOJ (ORCPT + 99 others); Tue, 21 Nov 2023 00:14:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjKUFOI (ORCPT ); Tue, 21 Nov 2023 00:14:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23720DC for ; Mon, 20 Nov 2023 21:14:05 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8209C433CD for ; Tue, 21 Nov 2023 05:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700543644; bh=cMMYeOK0yl8K/W6tITA9adS7M/SnAYmBYlglt9NNBgs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=RTMGDAw4aaIl9p63SCbvf+axeMK1Qpqu3ZhPt5GgZ72SZeyqNj33E/2+xbbksRwv4 61r9DkAghPdqeBx+PVGeEYObOY3vfzZyfGBygpp/bXF1E8qhZ94Gj9vGGYaOWdk755 9pTt0e4uiiyoTNjGcKwMe/gr2xUQcpqMLTW4qRJ4RWwzXq3Mux3ELfJXI+uMaS1u/L yv/zDpYcG/IBITnVcwxplWsfWDdmIQHvSNobCjNFaYnrK8uwhbRkjjns3EKHLyDkYY pIBYnIVPLzw+7FODaStq8REeKFaYJww/Hs6p4fhngNAszkpwzbFcwsPAmvF8/ljL+z lIzmeB6es7upg== Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-5bcfc508d14so4083497a12.3 for ; Mon, 20 Nov 2023 21:14:04 -0800 (PST) X-Gm-Message-State: AOJu0Yw0b/8ESn977eowBtfnnS+hGjiGvM5csweN1tpfZUo6m9UGE3Ud LC5gabGUDjgrjyodWie8TFgsM4N0dot9lcoiprSWhQ== X-Received: by 2002:a05:6a20:3259:b0:187:cbb1:a6a2 with SMTP id hm25-20020a056a20325900b00187cbb1a6a2mr10188139pzc.21.1700543644182; Mon, 20 Nov 2023 21:14:04 -0800 (PST) MIME-Version: 1.0 References: <20231119194740.94101-1-ryncsn@gmail.com> <20231119194740.94101-9-ryncsn@gmail.com> <87r0klarjp.fsf@yhuang6-desk2.ccr.corp.intel.com> In-Reply-To: From: Chris Li Date: Mon, 20 Nov 2023 21:13:53 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/24] mm/swap: check readahead policy per entry To: Kairui Song Cc: "Huang, Ying" , linux-mm@kvack.org, Andrew Morton , David Hildenbrand , Hugh Dickins , Johannes Weiner , Matthew Wilcox , Michal Hocko , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 20 Nov 2023 21:14:25 -0800 (PST) On Mon, Nov 20, 2023 at 3:17=E2=80=AFAM Kairui Song wrot= e: ime. > > Hi Ying, > > Thanks for the review! > > For the first issue "fragmented readahead window", I was planning to > do an extra check in readahead path to skip readahead entries that are That makes sense. The read ahead is an optional thing for speed optimization. If the read ahead crosses the swap device boundaries. The read ahead portion can be capped. > on different swap devices, which is not hard to do, but this series is > growing too long so I thought it will be better done later. > > For the second issue, "is there any practical use for multiple swap", > I think actually there are. For example we are trying to use multi > layer swap for offloading memory of different hotness on servers. And > we also tried to implement a mechanism to migrate long sleep swap > entries from high performance SSD/RAMDISK swap to cheap HDD swap > device, with more than two layers of swap, which worked except the > upstream issue, that readahead policy will no longer work as expected. Thank you very much for sharing your usage case. I am proposing "memory.swap.tiers" in this email thread: https://lore.kernel.org/linux-mm/CAF8kJuOD6zq2VPcVdoZGvkzYX8iXn1akuYhNDJx-L= UdS+Sx3GA@mail.gmail.com/ It allows memcg to select which swap device/tiers it wants to opt in. Your SSD and HDD swap combination is what I have in mind as well. Chris