Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2162705rwl; Thu, 13 Apr 2023 02:30:22 -0700 (PDT) X-Google-Smtp-Source: AKy350YZxHzGzsXi2cj3uo7aLGTI5E4L2rJtuMmaGXBuHw3du6XxAEIYB/YdiYTI4hvYH0afnYBz X-Received: by 2002:a17:903:2346:b0:1a6:413c:4a3e with SMTP id c6-20020a170903234600b001a6413c4a3emr1919119plh.5.1681378222195; Thu, 13 Apr 2023 02:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681378222; cv=none; d=google.com; s=arc-20160816; b=KAy7lywmLl9gsyO6jMlrvsDeBa7yb2K+ydYBi7RCYDoTyLa/KtlZtdJGPkdAi6hlmc riRDwcv4uBzlNE/wOUMhOqxBXWesciY3gQXYxF3jRwILBfhK+3/1xgcxvIACK2Hhlq4z mLshTFtm3ec8Smz4jx8WUquBypQONYddVnSJkBT/aqjC/ogP/rsEF/8wnkJOQYW2rCKS 3LpDBSHKT7lAdkIPR/H6FJ39Q/n1D+OOXxLyipJpT7WK2n9ijh/XWL2Z+O3FjYpPoBKB FTaOEJY07iucKzk/99hPRYarpUTLPnXyAM6UO0+rGg+wx81HJUAH/dtRom7RSSJgUgn9 3zzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=6TykRGE7on+jWzSJP3pjbVXbyz/XWmQ1lmPnjTNqbt4=; b=BCFnemFBtrNwqJaHMU+Nq6TyLthLcvKMr4S83AWf+2bSufdI045Uc1ohAqfbO4fKKi c7ZFig6HC1RyjF5vshcxMrgMKFqFzmYUJI9FTT9WmrsnyEIgPEjRccMb+8DQY5dPmla1 LXGHS17v4mIlubncFFKAre3JSTc5uJ3fkF3KjbTa7eSY7L4cQjqX3jNRA4h5exKCrIis rkL0whHdsOu3sZwNnidZwM/uiIFq2tZvPeYVDHboneejnCbc+NRbjNDL6mpZhjGDJxqa oySYp4oPS8jkXW1cEzB0yEGc3VpsOrDvUZ4LyiVSxDYKH5/+Fe/sUof+TSBABbP2cj+y +Drg== 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 c11-20020a63da0b000000b00513a68ca71asi1707198pgh.742.2023.04.13.02.30.10; Thu, 13 Apr 2023 02:30:22 -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 S230193AbjDMJ0f (ORCPT + 99 others); Thu, 13 Apr 2023 05:26:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbjDMJ0e (ORCPT ); Thu, 13 Apr 2023 05:26:34 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52204106 for ; Thu, 13 Apr 2023 02:26:32 -0700 (PDT) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PxvHy2kz2z17SHT; Thu, 13 Apr 2023 17:22:54 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 13 Apr 2023 17:26:29 +0800 Message-ID: <2797d1c1-34cd-5dab-0db2-84a1bf493716@huawei.com> Date: Thu, 13 Apr 2023 17:26:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH 1/2] mm: memory-failure: Refactor add_to_kill() Content-Language: en-US To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Longlong Xia CC: "akpm@linux-foundation.org" , "linmiaohe@huawei.com" , "sunnanyong@huawei.com" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" References: <20230330074501.205092-1-xialonglong1@huawei.com> <20230330074501.205092-2-xialonglong1@huawei.com> <20230331054142.GA1435482@hori.linux.bs1.fc.nec.co.jp> From: Kefeng Wang In-Reply-To: <20230331054142.GA1435482@hori.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,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 2023/3/31 13:41, HORIGUCHI NAOYA(堀口 直也) wrote: > On Thu, Mar 30, 2023 at 03:45:00PM +0800, Longlong Xia wrote: >> The page_address_in_vma() is used to find the user virtual address of page >> in add_to_kill(), but it doesn't support ksm due to the ksm page->index >> unusable, add an addr as parameter to add_to_kill(), let's the caller to >> pass it, also rename the function to __add_to_kill(), and adding >> add_to_kill_anon_file() for handling anonymous pages and file pages, >> adding add_to_kill_fsdax() for handling fsdax pages. >> >> Signed-off-by: Longlong Xia >> --- >> mm/memory-failure.c | 29 +++++++++++++++++++++-------- >> 1 file changed, 21 insertions(+), 8 deletions(-) >> >> diff --git a/mm/memory-failure.c b/mm/memory-failure.c >> index a1ede7bdce95e..9ca058f659121 100644 >> --- a/mm/memory-failure.c >> +++ b/mm/memory-failure.c >> @@ -405,9 +405,9 @@ static unsigned long dev_pagemap_mapping_shift(struct vm_area_struct *vma, >> * page->mapping are sufficient for mapping the page back to its >> * corresponding user virtual address. >> */ >> -static void add_to_kill(struct task_struct *tsk, struct page *p, >> - pgoff_t fsdax_pgoff, struct vm_area_struct *vma, >> - struct list_head *to_kill) >> +static void __add_to_kill(struct task_struct *tsk, struct page *p, >> + struct vm_area_struct *vma, struct list_head *to_kill, >> + unsigned long addr, pgoff_t fsdax_pgoff) > > Hi, Longlong, > > The new argument addr seems to be used only from add_to_kill_ksm(), > so you can name the argument as such (like ksm_addr), as we do > for fsdax_pgoff (which is clear to be used only for fsdax)? Another option, move page_address_in_vma() from __add_to_kill() into add_to_kill_[anon_file/fsdax](), but use ksm_addr is fine with me, Reviewed-by: Kefeng Wang > > Thanks, > Naoya Horiguchi