From mboxrd@z Thu Jan 1 00:00:00 1970 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 6E2741F61C for ; Tue, 15 Oct 2024 02:34: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=1728959679; cv=none; b=obikLMPxEkwfklzZM3GbsiVPtmFu0pMH/3Y+TGD3ItH9JUlstSwB6ih7ILyoTbaepP9VUdrFAJbHEiRzQJfCaO2qq2wotgES6LREPaJNzd2HDrEPrHS+mR6qFQwWU0UE7xhVP2/FszUCmQUm02sDlMtMBcHaMc05LSr+VNzzuoA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728959679; c=relaxed/simple; bh=J96PNxXho6AM9q+vz7DQJDchGvgBPPRFe2c29HGeAEk=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=Wn7DOZ6ySt8bUq9Ei6uaePEZSE28mX8ay/f2/lch+V7/Z1SNp0W9AZZrbekNAG1UM+0q5ICXGEd5L2nkngXnRxlCuMtSeXPavkDsJ8TS3B+t4Xx0QTA1/yCnJvaBw7dOK88t3JMaJQSMrwKy559IUosInTy5dqbkedZtDJFe5Zk= 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=FqnEUUE+; 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="FqnEUUE+" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1728959675; 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=ZCOSs8NjOrK7JCDidX00nNIZGkMQE0/GRhp6aQzYnlc=; b=FqnEUUE+n6RFWCBcWGCHCiNREKt4ZvKr2xxWT+4dBB12Rw2thW3r/wofD1pXVtoqaZtjoD m0y0dJO/97D8mgNQw/fEFGX9k5ebQzf4mXgwEXbo7rzQoZMSe6KiTYgpW/QzkCQ4RoAkJ2 MUrhp0aMvdWTHWHdPKVGbE8RdfX78ns= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3818.100.11.1.3\)) Subject: Re: [PATCH] mm/swapfile: skip HugeTLB pages for unuse_vma X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20241015014521.570237-1-liushixin2@huawei.com> Date: Tue, 15 Oct 2024 10:33:36 +0800 Cc: Andrew Morton , Naoya Horiguchi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <20241015014521.570237-1-liushixin2@huawei.com> To: Liu Shixin X-Migadu-Flow: FLOW_OUT > On Oct 15, 2024, at 09:45, Liu Shixin wrote: > > I got a bad pud error and lost a 1GB HugeTLB when calling swapoff. > The problem can be reproduced by the following steps: > > 1. Allocate an anonymous 1GB HugeTLB and some other anonymous memory. > 2. Swapout the above anonymous memory. > 3. run swapoff and we will get a bad pud error in kernel message: > > mm/pgtable-generic.c:42: bad pud 00000000743d215d(84000001400000e7) > > We can tell that pud_clear_bad is called by pud_none_or_clear_bad > in unuse_pud_range() by ftrace. And therefore the HugeTLB pages will > never be freed because we lost it from page table. We can skip > HugeTLB pages for unuse_vma to fix it. > > Fixes: 0fe6e20b9c4c ("hugetlb, rmap: add reverse mapping for hugepage") > Signed-off-by: Liu Shixin Acked-by: Muchun Song Thanks.