From nobody Sun Dec 14 12:12:42 2025 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1C4726A0F2 for ; Fri, 18 Apr 2025 07:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744962758; cv=none; b=BlUE5/Xt4Q42jSbJNKOAVE4R212AMQzqvLXgWJ9tU8AiH6fvloDRN3FXzkIHYKsy/7AbnkVdiRNVL7j72APzAEKEM3gFSf7WgPwUaiKDOWdyMKaIV9gWlzYjanicZCaRVkWBYZXbMUz8aJFtusN9zo2S7WBpioPtbCBSANzFiWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744962758; c=relaxed/simple; bh=r4dN01ltDy7898Kv/798fP4bDvH9kh36i/O5cVD2LM0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b94j8qe1D6NdvsjDa8ytNKR4dsCzcdonD/DDcK2V+tLFb+Xrn1/iHc7W52NVORF8ptwPDe5d5q8P/PPD8/m7mB4J1va1EfvuTkm5LCFLyR5IWqu6cZ8bJR5OoQbZiIK/MaoPkQbCTrrVw6k9/anT8Vb5etlXtAuAoBHcM4yXk+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Is5Zvjnn; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Is5Zvjnn" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1744962753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OBuEFz8FseY66OhdFa8eDqvIegINB5zk/KQ3fZF4sJY=; b=Is5Zvjnn4X8fS8zZ3/kNEPaYpd/V1g8dYQpNa3x/zLvjA0cctPP0Mff+NFxkq9HQV8NZem MEbbq2AMlBufVavqscwoB60P3iQzDotowoXfDygDArQEe8sVHttPTxynkbbTS1bozBwlgO G/icmQKZoVcCID7gz5xyhtUqzvsGp7o= From: Ye Liu To: akpm@linux-foundation.org, linmiaohe@huawei.com, nao.horiguchi@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ye Liu Subject: [PATCH 1/3] mm/rmap: rename page__anon_vma to page_anon_vma for consistency Date: Fri, 18 Apr 2025 15:52:24 +0800 Message-Id: <20250418075226.695014-2-ye.liu@linux.dev> In-Reply-To: <20250418075226.695014-1-ye.liu@linux.dev> References: <20250418075226.695014-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Ye Liu Renamed local variable page__anon_vma in page_address_in_vma() to page_anon_vma. The previous naming convention of using double underscores (__) is unnecessary and inconsistent with typical kernel style, which uses single underscores to denote local variables. Also updated comments to reflect the new variable name. Functionality unchanged. Signed-off-by: Ye Liu Reviewed-by: Lorenzo Stoakes --- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 67bb273dfb80..b509c226e50d 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -789,13 +789,13 @@ unsigned long page_address_in_vma(const struct folio = *folio, const struct page *page, const struct vm_area_struct *vma) { if (folio_test_anon(folio)) { - struct anon_vma *page__anon_vma =3D folio_anon_vma(folio); + struct anon_vma *page_anon_vma =3D folio_anon_vma(folio); /* * Note: swapoff's unuse_vma() is more efficient with this * check, and needs it to match anon_vma when KSM is active. */ - if (!vma->anon_vma || !page__anon_vma || - vma->anon_vma->root !=3D page__anon_vma->root) + if (!vma->anon_vma || !page_anon_vma || + vma->anon_vma->root !=3D page_anon_vma->root) return -EFAULT; } else if (!vma->vm_file) { return -EFAULT; @@ -803,7 +803,7 @@ unsigned long page_address_in_vma(const struct folio *f= olio, return -EFAULT; } =20 - /* KSM folios don't reach here because of the !page__anon_vma check */ + /* KSM folios don't reach here because of the !page_anon_vma check */ return vma_address(vma, page_pgoff(folio, page), 1); } =20 --=20 2.25.1 From nobody Sun Dec 14 12:12:42 2025 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AD5126AA98 for ; Fri, 18 Apr 2025 07:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744962760; cv=none; b=Q0ZH97QwpWhm7XRqXzr0tBNPZTljAJv7HmVLNAiPWLOk+zGXr1vPWPvFVUGYsejTuLa/LEDzMOi8iicHTBvEbmXDRAtDTm5FKq37WUfWMfl5AhfLD3CkjIgjDHhzqDCmC13bBgpr4zGn2mEBVO31qKRzOFeXmSdI1mf6SnkZ/jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744962760; c=relaxed/simple; bh=iIlIRJaJ8Nk9baLTAldhAKHTfIUQ0a8HFvaz7lfJOqM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=qx5wyabAdrzbFt/FzMIg62ExtLbXzthOT4BWUSKGBjVA6UptpJHyaclSkVCk+cnLxV/bQcwdbSMrTrlh5sLSCWqWih+qGIWw16GZUGXUvTQEjDUzDCUdm0XYcpLymxmbNoo4cvS9PtyTW1zNMYPKkvISLt7c93Xn8j5ueFNG6JE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=aSDK3B9G; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="aSDK3B9G" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1744962755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oGO08xLxOYFwCfCougkQzxDVIQkhT4UpNDlADOdXRwg=; b=aSDK3B9Gdkc6xPZClLQveXZgHE+BbIv50MzsXv7VhKPap4JbnCo27Qo+f8UC7+CXcZG7gk RRjz/wPHtPRIbJrCcf6g47tQtB+kyfz9ZUfh9hWbnZeDSq7lIVhoZ/hHDyql9dm+OhuYEA M9QZEwThq4CPq4sH9WX9XR5okq20jUM= From: Ye Liu To: akpm@linux-foundation.org, linmiaohe@huawei.com, nao.horiguchi@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ye Liu Subject: [PATCH 2/3] mm/rmap: fix typo in comment in page_address_in_vma Date: Fri, 18 Apr 2025 15:52:25 +0800 Message-Id: <20250418075226.695014-3-ye.liu@linux.dev> In-Reply-To: <20250418075226.695014-1-ye.liu@linux.dev> References: <20250418075226.695014-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT From: Ye Liu Fixes a minor typo in the comment above page_address_in_vma(): "responsibililty" =E2=86=92 "responsibility" Signed-off-by: Ye Liu Reviewed-by: Lorenzo Stoakes --- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/rmap.c b/mm/rmap.c index b509c226e50d..a9eed8981e18 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -774,7 +774,7 @@ static bool should_defer_flush(struct mm_struct *mm, en= um ttu_flags flags) * @vma: The VMA we need to know the address in. * * Calculates the user virtual address of this page in the specified VMA. - * It is the caller's responsibililty to check the page is actually + * It is the caller's responsibility to check the page is actually * within the VMA. There may not currently be a PTE pointing at this * page, but if a page fault occurs at this address, this is the page * which will be accessed. --=20 2.25.1 From nobody Sun Dec 14 12:12:42 2025 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEEBB26F440 for ; Fri, 18 Apr 2025 07:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744962762; cv=none; b=KppdY09UyIZMYLC3L2n5rX+ZLWLAMMSx11g9GlDt1lWFQRzHCWg1HePb2bwj8knOI3Ud2tdvltp29Ze9rsfiDZloeWHPrJIPWPc9wAnuBnOU6AHCoA5v27VjDgQAc8AtCfPHHx5C/2Hqvd3gcD6JURmBzqTxAdrU6zK636R6vrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744962762; c=relaxed/simple; bh=LBaE/F1QcvD/Lvg9TxgK6v66T01sy1BB7QvxlMpl+eU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Rrv3+i055YJxud3u9YRhMkVfv+bluLHw7d/1qNb/hk5FF17UGcieMJkO7W6BKbnZSJ2I1PICCk/1/1PPlyrtqlzNT8JEtZedUF7C/GEJHGtGELyS0Paz3KJIg6+8Zkj70tCxY280ATzDB3X4yYxAXZVr/MSd+k1D99xfVuRJag4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=b7/nnHZn; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="b7/nnHZn" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1744962757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jfNHyiDXaAMkKJ+cGlnyxg4krHqlNBlOgidwEUdtskI=; b=b7/nnHZnclVg19ysg8Nipk7mI3Dp+HjYg3vRA6vsim5CIgnseKXebJaEIpxWaY4n0930wX GDOn9Pn1bjFYUYeTA36963vnoeK1r+hPAbO1TLk5jyhwJkFrbsyneOEJFqwrvY8MOpYnQd yW9TPKizdK/bSXv+e8B0k2dGaldeIF8= From: Ye Liu To: akpm@linux-foundation.org, linmiaohe@huawei.com, nao.horiguchi@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ye Liu Subject: [PATCH 3/3] mm/memory-failure: inline add_to_kill_anon_file() logic at call sites Date: Fri, 18 Apr 2025 15:52:26 +0800 Message-Id: <20250418075226.695014-4-ye.liu@linux.dev> In-Reply-To: <20250418075226.695014-1-ye.liu@linux.dev> References: <20250418075226.695014-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Ye Liu The add_to_kill_anon_file() helper function only checked for -EFAULT return values before calling __add_to_kill(). Removes the unnecessary wrapper and moves the addr =3D=3D -EFAULT checks directly into collect_procs_anon() and collect_procs_file(). This ensures that error handling is performed close to where the address is derived (via page_mapped_in_vma() or page_address_in_vma()), rather than being obscured inside a helper function. No functional changes are introduced. Signed-off-by: Ye Liu --- mm/memory-failure.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index b91a33fb6c69..ec0041c95b27 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -486,15 +486,6 @@ static void __add_to_kill(struct task_struct *tsk, con= st struct page *p, list_add_tail(&tk->nd, to_kill); } =20 -static void add_to_kill_anon_file(struct task_struct *tsk, const struct pa= ge *p, - struct vm_area_struct *vma, struct list_head *to_kill, - unsigned long addr) -{ - if (addr =3D=3D -EFAULT) - return; - __add_to_kill(tsk, p, vma, to_kill, addr); -} - #ifdef CONFIG_KSM static bool task_in_to_kill_list(struct list_head *to_kill, struct task_struct *tsk) @@ -634,7 +625,8 @@ static void collect_procs_anon(const struct folio *foli= o, if (vma->vm_mm !=3D t->mm) continue; addr =3D page_mapped_in_vma(page, vma); - add_to_kill_anon_file(t, page, vma, to_kill, addr); + if (addr !=3D -EFAULT) + __add_to_kill(t, page, vma, to_kill, addr); } } rcu_read_unlock(); @@ -674,7 +666,8 @@ static void collect_procs_file(const struct folio *foli= o, if (vma->vm_mm !=3D t->mm) continue; addr =3D page_address_in_vma(folio, page, vma); - add_to_kill_anon_file(t, page, vma, to_kill, addr); + if (addr !=3D -EFAULT) + __add_to_kill(t, page, vma, to_kill, addr); } } rcu_read_unlock(); --=20 2.25.1