Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1303092rdb; Wed, 24 Jan 2024 10:40:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlopIwpv6NfTAVk6KIPgxl/xcgHsVoy5tK5VJ4kQ44uf5Y4teGsRqzctNWaVjfWtJ8XJBD X-Received: by 2002:a17:906:d002:b0:a2f:c0cb:3d4a with SMTP id z2-20020a170906d00200b00a2fc0cb3d4amr551595ejy.284.1706121620396; Wed, 24 Jan 2024 10:40:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706121620; cv=pass; d=google.com; s=arc-20160816; b=pCe07FOJcDYoRl5mM2PlkWxiIAsRlYK7udZsQSFWGzdNOhf9qDn3YMG2CMXN/UQkb0 +dWIPFZX8q4Yom/wraufhySbuczzMo7BJv3AJcFD2cY4+SIBifKGe0vCJ8gusyHcX4eA SSiYZbRcTPnbeSDiVP5V4qUcnCl8I9Fi4ILdVJEm5mGF5J5pnUUxwvI0k3B1Gz7K1LRF fKFENZ9+CXeED/84+WRuxIV2h2NKQ6z/Ho8loqs3DkDPsFCjeVx4mlok4Oaw0dhYWrbo fm3n5/ppJbQQ/saLGvodR6yBKnSD50vJ117zYgg+gLY/wVoZ5kisg2EdNXfiJ2xN4WB9 57lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=draqL+CE/rP10cXaUi8xoo+aCaYER4SdwSjRFB4PIm8=; fh=BJ1c8AKet1p2iOYDpNdLk2fkjgjj3f2Tak0lQDPZwLM=; b=W30LgP122m1I7K21h1sAFJ1ttMChvWCEZit+GeE3z/nvvLeQ+e3m6Rg1nwADDSGEKu pGBcXcd1FbStLnmISaeqs+yaIq8nUjKGhA1+LqDszmEcMFaccD6oKZRkVzOTb9VnD0mr 5aDlEYxjmStZTSo5mOt1ZfrQoOvaySwy3Mj5HworR6Yguva6Z9WUcryhMFAh6ZTr6r0B 8EmBFOZY04GcrdH9dX0+DRmn+LRYjbaSYKgnPgx7hgWhu/4O67SZ8kbRza0EnAm9R1MS HpIXI+1k63obEBZhT3nY8WECPvXW6RsZdrrQmHZUqigd/uGePlNGJHynaCDZEPN88Qsr nU5Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=g+zmg+Ym; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-37532-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37532-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fi2-20020a170906da0200b00a2f164f2511si133302ejb.692.2024.01.24.10.40.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 10:40:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37532-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=g+zmg+Ym; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-37532-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37532-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 08B041F23400 for ; Wed, 24 Jan 2024 18:40:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBEEB131733; Wed, 24 Jan 2024 18:40:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="g+zmg+Ym" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 113587CF3F for ; Wed, 24 Jan 2024 18:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706121612; cv=none; b=PNxpiwI1yhQt0EWg5li/x2T5cFNlS1cJE4FBZgVAxRl/ffaL02ucSRFZjjR5HGoHsTiO3SOi4EHE3ahBSA1drvTCw3D2teAeOEYGhWIxBVs26OJY0lggHdPqSbJ7xFe75LsevC1P7NVjnWJWWorUD9bX1J8F8M7qXiQv9qwmrCo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706121612; c=relaxed/simple; bh=EMjjgo6EOUSHuhiIbOnLdaQNvcS1crAmIlcHC3Ptc8c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eeaZ8A7ILc7SPmYcT44bM2bWCB23p3OuXF8MmR+9SAg2veush0++viZjBIr/6lzL/ffbYtSy/aGTMo1ewpaw3GJxIXwotUkrPcyOyc9XvEXc4oH0BvSab+o7gMAfTDTYWC4mXmPKfO58pIXLiP2GJ5LlhVB4BxLKpnY9hPEJcmA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=g+zmg+Ym; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=draqL+CE/rP10cXaUi8xoo+aCaYER4SdwSjRFB4PIm8=; b=g+zmg+YmwmdzlghpYwJW/wat/t I/cEHh96j3CYzc1CTJqQpLR5HDfuqmoh7R+NZ42ScpDxaJF6gVLHWAL2nZchFm5v58pWmvbMeglcZ MzyF6Q2qAJeOzsmHNiGeTCRXXfqxTMW5L6tBKrwj5/B/oTA3UQ4ZS004KWeY9HEpm3HT5JyHChscz UFlgYfyno6PQR58/cQhX1glfFvyaelEpSFCbyIa0W8qR5M3QHKUwgZOhkm9A8xE9xMd05M/SaoN7s payZ5Eq73rquLSQmgMppR1ujBfIE5U0Xfucr3M/h90xU8t2SQfIvShi22ZeFYcHm+/0UNeBD9xqcB X3Zp449A==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSiAR-00000007SKc-2nnP; Wed, 24 Jan 2024 18:40:07 +0000 Date: Wed, 24 Jan 2024 18:40:07 +0000 From: Matthew Wilcox To: Haiqiang Gong =?utf-8?B?KOm+mua1t+W8uik=?= Cc: "linux-kernel@vger.kernel.org" , Mike Zhang =?utf-8?B?KOW8oOS8n+S8nyk=?= , Andrew Morton , Matthias Brugger , AngeloGioacchino Del Regno , "linux-mm@kvack.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mediatek@lists.infradead.org" Subject: Re: =?utf-8?B?5Zue5aSNOiBbUEFUQ0g=?= =?utf-8?Q?=5D?= mm/compaction: add check mechanism to avoid cma alloc fail Message-ID: References: <20240122022317.30091-1-Haiqiang.Gong@mediatek.com> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jan 24, 2024 at 07:20:53AM +0000, Haiqiang Gong (龚海强) wrote: > > I don't understand.  You say that the memory isn't movable, but then you > > say that it's migrated in.  So it was movable, but it's no longer > > movable after being moved once?  > Sorry for not expressing clearly > When doing memory migration, the kernel will determine whether the current > page can be moved based on the refcount and mapcount of the current page. > This memory can be moved during kernel compaction. At this time, refcount > is less than or equal to mapcount. > After this memory is kcompacted and placed in the cma buffer, under > certain special conditions, the refcount may be greater than the mapcount > (ex:the current page is being used by fs), and then migrate will fail. But that's always true. Any page that is currently in use might have its refcount temporarily incremented. There's nothing special about pages that belong to a file. You've basically just prevented all filesystem memory from being migrated to the CMA area, and that's wrong. What's special about this page? Or were you just unlucky?