Message ID | 63c92f1e2a2fa6267490ab9fad5b090316b39b98.1730360798.git.zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60028E68958 for <linux-mm@archiver.kernel.org>; Thu, 31 Oct 2024 08:14:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF0756B009B; Thu, 31 Oct 2024 04:14:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA19A6B009C; Thu, 31 Oct 2024 04:14:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D41A46B009D; Thu, 31 Oct 2024 04:14:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B547B6B009B for <linux-mm@kvack.org>; Thu, 31 Oct 2024 04:14:35 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 62C1AACC01 for <linux-mm@kvack.org>; Thu, 31 Oct 2024 08:14:35 +0000 (UTC) X-FDA: 82733185458.14.2BC2214 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf28.hostedemail.com (Postfix) with ESMTP id 766D6C0009 for <linux-mm@kvack.org>; Thu, 31 Oct 2024 08:14:06 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="VB2Cs/uJ"; spf=pass (imf28.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.53 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730362342; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PXIV/VGyywoEEnyyPnCjvRn11K4iZ53lY17h1S4nRMU=; b=ZIPX0h2wASATi70DT4kaDr/erEnkug3EM5edvYiJdUnnkjKgPgiy1wU9OZxjhI2qHVRiQ3 ntA8eg1aioQMMEcjvDM68x+aMPYkZXrfL+M2SIP4Db8g9rt6qFPX2AJvH7Gr69p+FVH/Wf ZfnCNqfhtwuNYjVY1+MYTMLi+X9BrAs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730362342; a=rsa-sha256; cv=none; b=zJit5QDjw3DgJI9YFrH4dVCgbR9zDck067JelBWcHK3lKAigK8Gy3cgGugg9k6+ull94Zp SCR/ZN6k0+fsnc9m2BjgihW0JPaMlBBMfZM3D4M+UIa2pd1LfBmhGb9pDjIAv7v4lg/2Yd 0RhVEVaq2i0xMJy/O6Huvyfn4YCDhKs= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="VB2Cs/uJ"; spf=pass (imf28.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.53 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2e2cc47f1d7so499239a91.0 for <linux-mm@kvack.org>; Thu, 31 Oct 2024 01:14:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1730362472; x=1730967272; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PXIV/VGyywoEEnyyPnCjvRn11K4iZ53lY17h1S4nRMU=; b=VB2Cs/uJZW03EiI2DQ2AagrIXDQU8JoQGqJwFPbh6jw+XeUYvqR2YGpa5bDB5+cohq qxOOL0tuZ9DF4G1Kwa6EC+sP1VpfJgNJengFDr8fhy3hRgSZgpU9/PYoR11l1m6JO5jY RFwRfojCak2y5J1lSmLywMTINrCPb5SiiFWjN+qxA5q+dmlg1irb6j4HV9ON8g3QJV7L Fp14GanKFN5cx6Dj4VQQMPpvP2T/EP6gj+PAmCHfXRa6u2uHuTexe+oMfCvsQ6Y2HCMH oT3eZY9aMXf6p2bEer1ZUzPvh7z8rpfmbAshXWm1wV7UP68ju9kNdmbkBWpV9lQpMXW6 RM4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730362472; x=1730967272; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PXIV/VGyywoEEnyyPnCjvRn11K4iZ53lY17h1S4nRMU=; b=HR3KKEwQHzrX4eTd+hZlcxdbwecHQQpi55qQ+8NnywEL2+hyMomCtHDc4k4aeOzxHz aVxpZl8RvEHjHkdDcO2HMP7euOC5ROHl1DYguVLxX2v0Eha+CjPrt+EHWiTAIh5ZIrWU 6h75hpBjS8PbVsc5wYa32x5JDe3Z6uL2MtZkMtUQovChI9T/FOoAUR6SR/zk/AdvDI6L 1ujoFWn2VFGliKYpCSqJONlJIT2Ca3iqqsoW5hhTak7QYMzQAMUxRQczB6UOpm5Qlm3p NOYHArVBD1ukx18/vRgo5ihaw0FpJlYF8487oT5v8oI3fJn+xAgyrHj845Bi5sYfEDOy l45Q== X-Gm-Message-State: AOJu0YwS4FZT8OoSV0IGIaLiaHh/EtxtUzxxr6nUOAg0e3MlTOzsV+qq LLPmJSZD0CNhkHkiulfQ4sm6koMrqasU0maLxLI4Q8BRHbEMjukIpu5u7xjEFPQ= X-Google-Smtp-Source: AGHT+IHX23XnGunJsTXB9lUCwZL9x2plTKY2+aB5lG85OOgVbjA/C6wsUFYSS/R0cYtYXLJhUsQsBA== X-Received: by 2002:a17:90b:1b4a:b0:2e9:20d8:414c with SMTP id 98e67ed59e1d1-2e93e0139a2mr2423394a91.5.1730362472334; Thu, 31 Oct 2024 01:14:32 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.149]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e9201b2586sm5163996a91.0.2024.10.31.01.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 01:14:31 -0700 (PDT) From: Qi Zheng <zhengqi.arch@bytedance.com> To: david@redhat.com, jannh@google.com, hughd@google.com, willy@infradead.org, mgorman@suse.de, muchun.song@linux.dev, vbabka@kernel.org, akpm@linux-foundation.org, zokeefe@google.com, rientjes@google.com, peterx@redhat.com, catalin.marinas@arm.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, Qi Zheng <zhengqi.arch@bytedance.com> Subject: [PATCH v2 4/7] mm: make zap_pte_range() handle full within-PMD range Date: Thu, 31 Oct 2024 16:13:20 +0800 Message-Id: <63c92f1e2a2fa6267490ab9fad5b090316b39b98.1730360798.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <cover.1730360798.git.zhengqi.arch@bytedance.com> References: <cover.1730360798.git.zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 766D6C0009 X-Stat-Signature: wxhrb68iai7rb1wom4n1ycmnozbtdna3 X-HE-Tag: 1730362446-342290 X-HE-Meta: U2FsdGVkX19vQImwaG6vjXXo0QmAvcMIRPz5pmyBhvILuROrdYFU0eTdvWEx59Wk7YGTN2x9NcJfoRIiIBPjRUdFLzHwqM5pw9vik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OiMGM7lPrgqd9zPPHHwKxVq7bysyXG3+ZY1z8xsbxukZhvsciCjY1DZWE19YcPNjuc1PkpGG/d7kVgPeK7cRsk7ufPBShus/kq/RrsOFls23jCxM7LB88AcVAyViOo9877BiRe69EE6IXYUhjabytinIaDxjQ5VlKLtTZ05K594kdxe5U= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
synchronously scan and reclaim empty user PTE pages
|
expand
|
diff --git a/mm/memory.c b/mm/memory.c index c1150e62dd073..002aa4f454fa0 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1691,6 +1691,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, pte_t *pte; int nr; +retry: tlb_change_page_size(tlb, PAGE_SIZE); init_rss_vec(rss); start_pte = pte = pte_offset_map_lock(mm, pmd, addr, &ptl); @@ -1730,6 +1731,13 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, if (force_flush) tlb_flush_mmu(tlb); + if (addr != end) { + cond_resched(); + force_flush = false; + force_break = false; + goto retry; + } + return addr; }
In preparation for reclaiming empty PTE pages, this commit first makes zap_pte_range() to handle the full within-PMD range, so that we can more easily detect and free PTE pages in this function in subsequent commits. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- mm/memory.c | 8 ++++++++ 1 file changed, 8 insertions(+)