Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6147563rwr; Tue, 9 May 2023 10:52:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Ewmmp6Ctq1m6GN3DiC877uIJMPdLWWHIGTpAYVAF2Al3xuzLfFlqaDH07KbBXIwYfkgZ5 X-Received: by 2002:a17:902:be01:b0:1a8:1c9a:f68 with SMTP id r1-20020a170902be0100b001a81c9a0f68mr14861280pls.36.1683654775827; Tue, 09 May 2023 10:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683654775; cv=none; d=google.com; s=arc-20160816; b=e9vDmdBHuYlB01BT9IPtMg5tV6JgRwvvHRiY+XJui9r2JIFvp9Qo5fv7JJwote4vz+ pHrEMTknd/iRt0h+hLtV25eb3rTAWlAZoA+8YgLsDxdFKk0QhIiFx3M0jiIrGxLnDtqs 9s885llu3ifUwkth+UBSLvO+iHJiVI86yYAcpHzxIkqEfnU27ZM6ZRsYiV6So4tggPFD cdFgK6MJs9TPq1+ejf5/x1LoanDe6KYG1F5gqU+a18eFMLfBcfi3xGE2SDfEWc1u13Pg mpTO8nLWJ31voq6vrl+mwK9rYzSCH+lWEFP/NxTE9gWzKgcYAsuc8XUr/IDiht61v28W BsNQ== 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=r0fIZgngQ9KHUBi5LfmXg+eaALuyGPQn+Ww+ZIcPQ0U=; b=yccHCqqpzQf66Gm295HObzO2PQy07/4sLxCe2/W0M/2DdSuW/W3kiiDSjJSbl8cexB 8o1Zmw9A5krz3vbrFaAG405Uyem2Lxx6HSrOU9mBcOG5VvVVup8XiUtGC2lOrUVlddVH sh4mBmm5Moau/Jnu6C1+Y9p9QpEpS5M8cBUy6jvRKOiSQ2VpFeVUNMhynPkCrsT/aynR jIR/VMMVK1RCAf0y1LJ85hrDDkGT8wruh+SJPgWaH42DuDNWw5BgGr13LJ9hw2wEAGb1 HJjt4ugTw9g6NhMoS1N16MeWWq6g9aMIxkEFGmpkugwJX5ZqgUA3+archhdb7yZOjGBr hjOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=kxFqD539; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a170903244800b001a1b0a828a8si2026730pls.621.2023.05.09.10.52.41; Tue, 09 May 2023 10:52:55 -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=@cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=kxFqD539; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229826AbjEIRoH (ORCPT + 99 others); Tue, 9 May 2023 13:44:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbjEIRoF (ORCPT ); Tue, 9 May 2023 13:44:05 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE3940C0 for ; Tue, 9 May 2023 10:44:03 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-3ef32014101so63624801cf.3 for ; Tue, 09 May 2023 10:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1683654243; x=1686246243; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=r0fIZgngQ9KHUBi5LfmXg+eaALuyGPQn+Ww+ZIcPQ0U=; b=kxFqD539zFnEkgBZCYyu7NnPFgh0kPFxYhBgiNDcdQ1+OA/nVtDxlzETKFEbeVZqzp EwJLxSPF6INV07BIfVc6eR+nO4TtYvRj+ieIwKUVc3TXytgXqf6MHQVw/0tUP7D/m/kT 7qLBu+YynZ5mDWd9WNgORyRNnY+SucsJ1ND/bsy2zWWCmX5/FFr+cQIK5MLaNIN9il1I ATICBudLSSbANJGlOLiL9+j9S50UBkCjWRxOceUrlsuYph/lRISpphJS9TTIP+730otz ZEJ9Bv2BGpmvaoeLyl+rCE0ZtqA5QLVyQlls0NTs/o6S3nME6ivIraebaBP6oyPI3NYJ +H7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683654243; x=1686246243; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=r0fIZgngQ9KHUBi5LfmXg+eaALuyGPQn+Ww+ZIcPQ0U=; b=RJ3r0Fc1GKghQ3ca3N5ObRuAnx+QWbW3SyUKvk0u4tX9fyPdjjIPkqP2mKIxwiBcHa nsUJ1iJc2v9yW3ZM+y4Nc6GUKpzqfJjINd8f9jOUy9D1Fe0zHbap+WOL4T2l8xQ76UbF 7bTYT+bB1ATG8riniqG3UXV9Bk4CKdv27DJrZ+rrxIn4N3mmFHlhtmO5NLnF3lPlcTuf 6g+zevm/vyrj+FcpGz3ikJ22dGe5LyxJMdJxm8EZvkA0rrL0aTupYRuWF9YaYjRHdw/C 7rToPDp4HQE45Sk0qDlcHqqkG9r2uF3fMdDNmVtToLHL2IipX+KQWZPLjj2LXQX00ZsZ o1Fw== X-Gm-Message-State: AC+VfDzKZt5Adw3Rv19X4sc+nMbgpAuiMCklPxt3+YWClk8B0qQxCfiB j0oXEue+oNu6VO0jUYbBA/Fybg== X-Received: by 2002:ac8:7f89:0:b0:3f3:9564:1135 with SMTP id z9-20020ac87f89000000b003f395641135mr6539548qtj.8.1683654242784; Tue, 09 May 2023 10:44:02 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-8f57-5681-ccd3-4a2e.res6.spectrum.com. [2603:7000:c01:2716:8f57:5681:ccd3:4a2e]) by smtp.gmail.com with ESMTPSA id f5-20020ac840c5000000b003e0945575dasm373105qtm.1.2023.05.09.10.44.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 10:44:02 -0700 (PDT) Date: Tue, 9 May 2023 13:44:01 -0400 From: Johannes Weiner To: Sergey Senozhatsky Cc: Nhat Pham , Minchan Kim , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ngupta@vflare.org, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, kernel-team@meta.com Subject: Re: [PATCH] zsmalloc: move LRU update from zs_map_object() to zs_malloc() Message-ID: <20230509174401.GA18828@cmpxchg.org> References: <20230505185054.2417128-1-nphamcs@gmail.com> <20230506030140.GC3281499@google.com> <20230508140658.GA3421@cmpxchg.org> <20230509030030.GD11511@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230509030030.GD11511@google.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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-kernel@vger.kernel.org On Tue, May 09, 2023 at 12:00:30PM +0900, Sergey Senozhatsky wrote: > On (23/05/08 09:00), Nhat Pham wrote: > > > The deeper bug here is that zs_map_object() tries to add the page to > > > the LRU list while the shrinker has it isolated for reclaim. This is > > > way too sutble and error prone. Even if it worked now, it'll cause > > > corruption issues down the line. > > > > > > For example, Nhat is adding a secondary entry point to reclaim. > > > Reclaim expects that a page that's on the LRU is also on the fullness > > > list, so this would lead to a double remove_zspage() and BUG_ON(). > > > > > > This patch doesn't just fix the crash, it eliminates the deeper LRU > > > isolation issue and makes the code more robust and simple. > > > > I agree. IMO, less unnecessary concurrent interaction is always a > > win for developers' and maintainers' cognitive load. > > Thanks for all the explanations. > > > As a side benefit - this also gets rid of the inelegant check > > (mm == ZS_MM_WO). The fact that we had to include a > > a multi-paragraph explanation for a 3-line piece of code > > should have been a red flag. > > Minchan had some strong opinion on that, so we need to hear from him > before we decide how do we fix it. I'd be happy if he could validate the fix. But this fixes a crash, so the clock is ticking. I will also say, his was a design preference. One we agreed to only very reluctantly: https://lore.kernel.org/lkml/Y3f6habiVuV9LMcu@google.com/ Now we have a crash that is a direct result of it, and which cost us (and apparently is still costing us) time and energy to resolve. Unless somebody surfaces a real technical problem with the fix, I'd say let's do it our way this time.