Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1539122iob; Fri, 29 Apr 2022 07:30:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdnlokTkYT3i8590YNNCI0nzXHq6ITYkyt/wYOhzxhY2ZZPKkdY9Vm/oaJV+bvErZTPQv8 X-Received: by 2002:a05:6a00:c91:b0:50d:4f37:37df with SMTP id a17-20020a056a000c9100b0050d4f3737dfmr21211495pfv.66.1651242616588; Fri, 29 Apr 2022 07:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651242616; cv=none; d=google.com; s=arc-20160816; b=kVLFHsPPeWFAYso9b0VE5QeSMIPVNmSpX2zIX5W9QMQhO0e4FaXBMNp+qfWLymF+Oc u4k9POfrVQCVzcHC2Hhz0ofq+clZdkB9OGA+kbmZuuQ+4OC8uUxx4FLSIjIzgKe/Xm5a zDi5tZJOj8+LliuQpITXVOZv+mH4JUbbtrBOSslAo6dup2EHukNJFWSkKA0oE9/Edkgs 8AJfrI+al3yNODtNRXwWEiUdWNeg8e928hPbC0lazDdgPVJc7O/9BAHwIVmfCe4TO9k8 QD/yGUGVYUyy8C0DAwTiVdM44uMHSkH3Px6RKBPzY/UGHzaWuIELK5R2je3ZZully7+r BECg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=oie7tg07zfPt6MzasqCLP3pRJiwci4UXm4nj7NXQbZE=; b=zL3K96v0r7CW8iqjm7W/foZlfznJUOrPAh4Gk6oUpBRd8LREKkNEn6JuPTVGSpIgGc i9ifLefQukReq7dfZOKLCUqILzvAyXeyIOjqb2xG60KgvOEP8CgfobSE8Qh9677WZNz2 5TfXUZQvw0sJaukmW4MrpDJ2fIvlJImXHyX+SjV6kYBQWXIIBFK+sRIjQQR7ZcQBKlT6 Dfut/um2jLpGwy3QAXeGaBAzsG1jK2X33EBdldBVOTCBfinyjoXTmtbIoMZahxenaC62 afH2JAzHTiIo+i71M0IraMjPgxnEsi5F/ws2HEbTN2mGLrsGlUfwpQPrdbAaokjEx9v7 rSnQ== ARC-Authentication-Results: i=1; mx.google.com; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n21-20020a63a515000000b003a9ee7f8defsi7357722pgf.295.2022.04.29.07.29.59; Fri, 29 Apr 2022 07:30:16 -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; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354697AbiD2GoN (ORCPT + 99 others); Fri, 29 Apr 2022 02:44:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234036AbiD2Gnv (ORCPT ); Fri, 29 Apr 2022 02:43:51 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC721B9F29 for ; Thu, 28 Apr 2022 23:40:34 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KqNCP6JCPzhYqr; Fri, 29 Apr 2022 14:40:17 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 29 Apr 2022 14:40:33 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH 4/9] mm/z3fold: throw warning on failure of trylock_page in z3fold_alloc Date: Fri, 29 Apr 2022 14:40:46 +0800 Message-ID: <20220429064051.61552-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220429064051.61552-1-linmiaohe@huawei.com> References: <20220429064051.61552-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 If trylock_page fails, the page won't be non-lru movable page. When this page is freed via free_z3fold_page, it will trigger bug on PageMovable check in __ClearPageMovable. Throw warning on failure of trylock_page to guard against such rare case just as what zsmalloc does. Signed-off-by: Miaohe Lin --- mm/z3fold.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/z3fold.c b/mm/z3fold.c index 4e6814c5694f..b3b4e65c107f 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -1122,10 +1122,9 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp, __SetPageMovable(page, pool->inode->i_mapping); unlock_page(page); } else { - if (trylock_page(page)) { - __SetPageMovable(page, pool->inode->i_mapping); - unlock_page(page); - } + WARN_ON(!trylock_page(page)); + __SetPageMovable(page, pool->inode->i_mapping); + unlock_page(page); } z3fold_page_lock(zhdr); -- 2.23.0