Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4017978rwi; Sun, 16 Oct 2022 23:36:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bhdG1fEgc655vX6wS+OeqLvD2usICdkiJlaTlJzRr4gHke5+e4Q83VU3LwNUQTOEPx55c X-Received: by 2002:a63:8949:0:b0:46b:2f56:a910 with SMTP id v70-20020a638949000000b0046b2f56a910mr9773877pgd.158.1665988609379; Sun, 16 Oct 2022 23:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665988609; cv=none; d=google.com; s=arc-20160816; b=taCIfW6oOjg/Ri1B22n0EGFgkSWb71b5wP7EtN9prmJThjXS/EEeSlyjgEUximG90L aEr6wmVB063MAhxtz/260sGXpHt6fis/SRh5A0oxHLsC/3pkUPlGyVpc5gMR7ShD0hnk 3lU62jDN04Dxv1RvfXXTFkaUbBy6QEs+L+5U7iT4VAg8vsWxArP7Nrbr3sjH7c1d/fzx bDvZ+vR5wjVVupP6Sa/9uT1tSPHhYM1ST4rqTYxMJ/zS4gUp0WZNgW8JVcbrqLmd+RMC ZzNdhVcQOqgpO2dm/WxOJ8HeaSBL6M1A3jUREkwjblv2B/6jVB3BaRdCiDnTDiDxdjl7 pvcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FbGjBODuQ2aXd0SxGNOvscm2oLYVXviHbbZBm/YkLLI=; b=RQ9/YEyKUyKUPq6ghp0OCaaG3ydJAevTp2v9pTz7cZ+vRxLmtUs4llaXewxqMDxfEf o6dJaFQxEAyoY7FA6TOZvPDWaer6TpwDfpWerTJ8iv7IYXKsrBPtf13c9ZVjHs9Xl+IO Q0j6nNZ2y70mo25LC5/269mYiywXc8BbZBvhuI2Ad6RtjBBxf+keDV7eXP+iP7GS7+rA T/10P+uAX8U96crHJcls/9MXknLWNih7A+d0YPjFu0q1cUYc2Ane4ypc1rhMMOUFWPe8 Oa/z2Pn5ntaDrMbwCnYwFf25jBfJ5E4cWW06VXwyREDIvNsJyQLA3Z3wq0iUYnuthKVB cA5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WmlvmBDX; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc11-20020a656d8b000000b0042af7555d10si10317190pgb.862.2022.10.16.23.36.34; Sun, 16 Oct 2022 23:36:49 -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=@gmail.com header.s=20210112 header.b=WmlvmBDX; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230029AbiJQFer (ORCPT + 99 others); Mon, 17 Oct 2022 01:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbiJQFeo (ORCPT ); Mon, 17 Oct 2022 01:34:44 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80FE12317C; Sun, 16 Oct 2022 22:34:43 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id bu25so15883957lfb.3; Sun, 16 Oct 2022 22:34:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FbGjBODuQ2aXd0SxGNOvscm2oLYVXviHbbZBm/YkLLI=; b=WmlvmBDXm0Zg0nD0h/VDt7tmRL2ZZOsHNGNIlOFNuMXPEktuQyJaKBT+JrFnE9jZVc UkdCK3V/YQzAazPVDvs5CAdWbLq+4SfjipHveGsms9K6YK849CLDfEhz7tBRC6i7zK/Q m1v/5IIv7rdDoMXbcOqVKSXg+QCPIZbZAbL1GX8NFiYk30DiWqS/Z+U/XGBeTt9adgye MJ2Op4VqgbhyRCvVBcQ/tfgeeBB3p1Z7X3lawXI2yOxNnApPbUSjbFnI4PILBrPy6H3/ K5k7d50pri3imhOk55WvjUQzhXFHXOTvULrERTOrv02/Qb/XvJaIoVKy86HZQeSdRIQb Yumg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=FbGjBODuQ2aXd0SxGNOvscm2oLYVXviHbbZBm/YkLLI=; b=z22xgjpARX1O0SmVTuavB2q4WI/oRuBN8BAuzh0HinA/wySxUihQKx5htToCX7iVx7 2CfPvRxkkydWtovdRbrIKsy3pjinbw1qZnj8mVtmPTNQMpWGi9xN1ypcLvYiGCDG1n/e s7nIWKRvSAp4jWF7wDekYfXfGcXKbuDCgwSnMbw1XwKWHDLa3AHNSa4ZOocY7+jNcZLr r1g9ahcxj4Ffrfir0FXiLc183/6pFPl+KBPttyRfEm7fszwuue9IlhpIyL/yidKiWniP XSVYON42AtqgECNlabckVveXaM0lWqKwCIGQBF+iOB99YSuHZTPrKlfsfZ3eitOtLqO/ +sTg== X-Gm-Message-State: ACrzQf0IzgRx9d/49ovDDieaEqTlYahnF+/+cJ7zBdE5DdioYeA7FP1c mU6hRPwSeUgdNZW0E/Le162E2J1bFg/SpnwTIfd17r2ohsU= X-Received: by 2002:a05:6512:224d:b0:4a2:7710:9b8b with SMTP id i13-20020a056512224d00b004a277109b8bmr3109060lfu.128.1665984881754; Sun, 16 Oct 2022 22:34:41 -0700 (PDT) MIME-Version: 1.0 References: <1665725448-31439-1-git-send-email-zhaoyang.huang@unisoc.com> In-Reply-To: From: Zhaoyang Huang Date: Mon, 17 Oct 2022 13:34:13 +0800 Message-ID: Subject: Re: [RFC PATCH] mm: move xa forward when run across zombie page To: Matthew Wilcox Cc: "zhaoyang.huang" , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, ke.wang@unisoc.com, steve.kang@unisoc.com, baocong.liu@unisoc.com, linux-fsdevel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Fri, Oct 14, 2022 at 8:12 PM Matthew Wilcox wrote: > > On Fri, Oct 14, 2022 at 01:30:48PM +0800, zhaoyang.huang wrote: > > From: Zhaoyang Huang > > > > Bellowing RCU stall is reported where kswapd traps in a live lock when shrink > > superblock's inode list. The direct reason is zombie page keeps staying on the > > xarray's slot and make the check and retry loop permanently. The root cause is unknown yet > > and supposed could be an xa update without synchronize_rcu etc. I would like to > > suggest skip this page to break the live lock as a workaround. > > No, the underlying bug should be fixed. > > > if (!folio || xa_is_value(folio)) > > return folio; > > > > - if (!folio_try_get_rcu(folio)) > > + if (!folio_try_get_rcu(folio)) { > > + xas_advance(xas, folio->index + folio_nr_pages(folio) - 1); > > goto reset; > > + } > > You can't do this anyway. To call folio_nr_pages() and to look at > folio->index, you must have a refcount on the page, and this is the > path where we failed to get the refcount. OK, could I move the xas like below? + if (!folio_try_get_rcu(folio)) { + xas_next_offset(xas); goto reset; + }