Message ID | e718e4afb0a387dc04d0e3cb8440d8de20adb011.1718690645.git.baolin.wang@linux.alibaba.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 BDB93C27C4F for <linux-mm@archiver.kernel.org>; Tue, 18 Jun 2024 06:54:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71EFE6B014A; Tue, 18 Jun 2024 02:54:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 630EE6B014C; Tue, 18 Jun 2024 02:54:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 460886B0154; Tue, 18 Jun 2024 02:54:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 29A9F6B014C for <linux-mm@kvack.org>; Tue, 18 Jun 2024 02:54:38 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E3772140338 for <linux-mm@kvack.org>; Tue, 18 Jun 2024 06:54:37 +0000 (UTC) X-FDA: 82243096194.14.ABF9911 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by imf24.hostedemail.com (Postfix) with ESMTP id E3B2B18000C for <linux-mm@kvack.org>; Tue, 18 Jun 2024 06:54:35 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=QA0sfXlY; spf=pass (imf24.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718693673; 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=OhkcTOgQo6MdSZjxEddX9KsK/pU+Rag0OqwoL0KeI6s=; b=OH1ZijgMRSCgzudF9DKZfif6SRJAL+PVG1yqWdC2/KJakU1XvmrHNybJKHBHhYArhXbfXX zbgSj/eHJvbktdWRjl852V0VXRdQX/Iuq43x2MaUaZAIsbD9jO5KtLQ94tYGldYfFxHiYl Ykf3VmyxtOMh3clTVnxGezchMAorq4w= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=QA0sfXlY; spf=pass (imf24.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718693673; a=rsa-sha256; cv=none; b=qrem/AKuVimlvSVlllouZuOhAHfS2ekunVOqrlHGxCmmSNpktv0mMzkIIPzhfGUao36ewc sYPifnQ7MVOO0Ul/nnNJBpuqZLeIu/x+aEHydvMyjepaSl8gwUqWzdF3Ry9VxIp1cjxvmi AVzJo0YRoEFHHsRNXTyUn85jShpm5tM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1718693673; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=OhkcTOgQo6MdSZjxEddX9KsK/pU+Rag0OqwoL0KeI6s=; b=QA0sfXlYV15E15qdzkw0ZovnsnlHgBubvGcUr0c/kim4zdkpUJg2wT3f/uPl/wRVZoXggpCIYnu/cmnl+lXnygF0BSyrAOK/EfSXNSQB9eQY/tPCGA3e7+tQvRiae1GdK06v093ovwVxq4Od6ZDOtIpYTO7XHoaxhNTY1IwpkHQ= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R881e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045046011;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0W8jFFLh_1718693672; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W8jFFLh_1718693672) by smtp.aliyun-inc.com; Tue, 18 Jun 2024 14:54:32 +0800 From: Baolin Wang <baolin.wang@linux.alibaba.com> To: akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, wangkefeng.wang@huawei.com, chrisl@kernel.org, ying.huang@intel.com, 21cnbao@gmail.com, ryan.roberts@arm.com, shy828301@gmail.com, ziy@nvidia.com, ioworker0@gmail.com, da.gomez@samsung.com, p.raghav@samsung.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/9] mm: filemap: use xa_get_order() to get the swap entry order Date: Tue, 18 Jun 2024 14:54:17 +0800 Message-Id: <e718e4afb0a387dc04d0e3cb8440d8de20adb011.1718690645.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <cover.1718690645.git.baolin.wang@linux.alibaba.com> References: <cover.1718690645.git.baolin.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E3B2B18000C X-Stat-Signature: j68hknggw5a86wsrz7xaejidy5zqspn1 X-HE-Tag: 1718693675-966117 X-HE-Meta: U2FsdGVkX1/MrMWD7LBux8s6zzBpVrnckAaNGpWn+o3FPgFwXhOPwVJbNoj9hzxURtv9vwLQQTRxVUqUPYzdhR30vUXOPUhHkMlo5bSMdvHj8Q/js9yW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jdde2VmNv6yDCRkz6FUPfKqRSBxPk45zGXcVZ2OeGWHRMdmuoPDMk1KuvFnoFY+xlk62l2Oavp6tr+flGYuwWIA== 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 |
support large folio swap-out and swap-in for shmem
|
expand
|
diff --git a/mm/filemap.c b/mm/filemap.c index 876cc64aadd7..ecc785758aaf 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2056,6 +2056,8 @@ unsigned find_get_entries(struct address_space *mapping, pgoff_t *start, folio = fbatch->folios[idx]; if (!xa_is_value(folio)) nr = folio_nr_pages(folio); + else + nr = 1 << xa_get_order(&mapping->i_pages, indices[idx]); *start = indices[idx] + nr; } return folio_batch_count(fbatch); @@ -2120,6 +2122,8 @@ unsigned find_lock_entries(struct address_space *mapping, pgoff_t *start, folio = fbatch->folios[idx]; if (!xa_is_value(folio)) nr = folio_nr_pages(folio); + else + nr = 1 << xa_get_order(&mapping->i_pages, indices[idx]); *start = indices[idx] + nr; } return folio_batch_count(fbatch);
In the following patches, shmem will support the swap out of large folios, which means the shmem mappings may contain large order swap entries, so using xa_get_order() to get the folio order of the shmem swap entry to update the '*start' correctly. Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> --- mm/filemap.c | 4 ++++ 1 file changed, 4 insertions(+)