Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp115217rwd; Tue, 30 May 2023 17:14:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4K905WDGbxZfcoTiMunLXlEtLAVd71YNIa/vJ7Ydk+8dHfx5RIATaOy0m/oYVYVc1ueL8E X-Received: by 2002:a17:90a:8c8c:b0:24e:44d1:18fd with SMTP id b12-20020a17090a8c8c00b0024e44d118fdmr4000399pjo.7.1685492091896; Tue, 30 May 2023 17:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685492091; cv=none; d=google.com; s=arc-20160816; b=uyAkkLYGM7gyPU+/gpcvVjwwW7x8uZmbAeV0jW8itWjAzoy4/7OV5fGyfaPRb4vNns oSMRxWkxKx+8EaKP1cCvZ3Ks+yFdkzPRrhjYxaABwRFmNOVvQDlTAwPA3rivz4cyZ4uO WJ7TeXWy8I2b58dxu0aMc0cjFhgKQZa3bPR6eHgNpsA4RWFygszntyjO+iIP5dLV3heg +VoZh1cTCui0seLmcNiFaeoJ/j4k3YAOT55aKE67AW+Pm0zgma5TLTssuu4WAeH46xSG b7ycut5jk5JMAqQNKER8uOi+yGRyCUR9RZ065SUygispQK6Fr91Qsy2AWzStXofl+Pr9 svWA== 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=irawpEcShcOFbqSfMe4v0NPnVegXzVzVnWF9D2giD9s=; b=pZelJmLo1kPxT0HwIfbzG5A8GvMWvAsRwiMZNv+RekllVmmYitip7v0TeTg6PUvW/D Akj69BNm1g7msU+jlaMz4y/wuZcstm1k7qxf7KpkGIOa9RI3zCpiCe+qNjmroxIw9fsO pRBD5IHCX0245xinZ7XcseqzUWgvNJWlrbCvnIhqMAJgHuHIX3L7iE8LTZuCPHcsL0nR Z7iNXNsyQZM9uhxdf8zH6z6AFTFO2p32q1wPBQzcEWcrsx1tT82xxipw/Ip0Wd35fA9R yNJc/7/U13sOlj06puvd9+p8M5nJzb8J4WVtH/SOHWlh2dYMVKDgfvLOeuJhKyF4+aTt VsvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=ZvOASTbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a170903230f00b001aae82caf75si12937610plh.66.2023.05.30.17.14.37; Tue, 30 May 2023 17:14:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@google.com header.s=20221208 header.b=ZvOASTbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233759AbjE3X5a (ORCPT + 99 others); Tue, 30 May 2023 19:57:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233675AbjE3X53 (ORCPT ); Tue, 30 May 2023 19:57:29 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E167FB2 for ; Tue, 30 May 2023 16:57:27 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-96f5685f902so771885366b.2 for ; Tue, 30 May 2023 16:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685491046; x=1688083046; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=irawpEcShcOFbqSfMe4v0NPnVegXzVzVnWF9D2giD9s=; b=ZvOASTbhIvwRaFys7hANyH9bpyOx4YlDxiR8GHKD9SYbZTnff95bSM5c/KQXM2H1pB pdiI1/rqdWnEcFR/zez/MU+STTlT2voj4r3xaA/2uf94J++3dpoeBOT8ohLoxHNOGpSR otxvghneVjyn7Z2raNtS0ED12iioF8OOiGRiBvP00Q9PiwRizM88FBSmgJKXQGKHQQk7 5reQmZ2oSmkYPCdI6on2I8Q1xpl0JB85hFySWjdhm+cooc1a2LLBWQ6ZkLSqaCyZT/Rg lgstxpduGP8MkEuqC+k9ezpN1jNnTUkfutoGUcQosE5KBo/xYRaOIOVpm79mYKlCi17v pryA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685491046; x=1688083046; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=irawpEcShcOFbqSfMe4v0NPnVegXzVzVnWF9D2giD9s=; b=JJ4TIkJBRdYCIcOoL/xeUpW9RqrMzMrSDFOPBuitFEymOb41yygJsxohxwjbu/4v89 DOr+2RAPJmiCTaiD3a1ZVuMIfmACBOP2OkoheW18toanoboY018NjRte0WBtPhghp8WU kuo3LYlejSJ5CSRJJas2F+n5cBef+Szlri1f+R8xqpklfUAGGfqK5fargSp3WSEJNvB7 leIZ3UgXFUwJFIOWl0cNxvx450faHOROfxGcsHmDxGNKbcQQK76nwmqXkewTPnmRHUW1 NqpfsYY+7iYQRLxgMvt1gCj+ttKSHhQEW0ul8tgPw+g3vSlboyBaCEOt5BrIJ0liLMhE wiMw== X-Gm-Message-State: AC+VfDwOFu0ZNSjBLZnRaae7r45akJNCfye0rMxd5EwiO6WCp2ysUtB3 0sqT9xNdUuiOm3d06fhRMJouPSTpHPLlJSqX+7+EAA== X-Received: by 2002:a17:907:16a3:b0:96a:f688:db6e with SMTP id hc35-20020a17090716a300b0096af688db6emr4385611ejc.74.1685491046241; Tue, 30 May 2023 16:57:26 -0700 (PDT) MIME-Version: 1.0 References: <20230530210251.493194-1-yosryahmed@google.com> <20230530235447.GB102494@cmpxchg.org> In-Reply-To: <20230530235447.GB102494@cmpxchg.org> From: Yosry Ahmed Date: Tue, 30 May 2023 16:56:49 -0700 Message-ID: Subject: Re: [PATCH] mm: zswap: support exclusive loads To: Johannes Weiner Cc: Konrad Rzeszutek Wilk , Andrew Morton , Seth Jennings , Dan Streetman , Vitaly Wool , Nhat Pham , Domenico Cerasuolo , Yu Zhao , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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-kernel@vger.kernel.org On Tue, May 30, 2023 at 4:54=E2=80=AFPM Johannes Weiner wrote: > > On Tue, May 30, 2023 at 09:02:51PM +0000, Yosry Ahmed wrote: > > @@ -216,8 +216,13 @@ int __frontswap_load(struct page *page) > > > > /* Try loading from each implementation, until one succeeds. */ > > ret =3D frontswap_ops->load(type, offset, page); > > - if (ret =3D=3D 0) > > + if (ret =3D=3D 0) { > > inc_frontswap_loads(); > > + if (frontswap_ops->exclusive_loads) { > > + SetPageDirty(page); > > + __frontswap_clear(sis, offset); > > + } > > Somewhat tangential, but is there still a point to the frontswap > layer? It seems usecases other than zswap have never materialized, at > least not in tree. Life would be a lot easier if we were to just > hardcode the zswap callbacks in the swap functions. > > It's not the patch's fault, but it highlights the boiler plate the > indirection causes. ->load() already has the page and could just dirty > it directly. Instead now both layers have to handle invalidation, > which is a vector for bugs. > > Can somebody think of reasons to keep it? If not, I'd take a stab at > removing it. I was intending to eventually remove it as part of the swap abstraction proposal I am working on, but this will take some time. If you want to remove it now, even better :)