Message ID | 20231106154950.3399469-9-wangkefeng.wang@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2749833vqu; Mon, 6 Nov 2023 07:50:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFATJceXYRXXYpXtaicL4u2xW9ql6pANftD2QSrjq5T67g5ZjEi7lxpJGiGeDlZhtvd2DDH X-Received: by 2002:a17:90b:a01:b0:277:68c3:64b9 with SMTP id gg1-20020a17090b0a0100b0027768c364b9mr15144597pjb.5.1699285844673; Mon, 06 Nov 2023 07:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699285844; cv=none; d=google.com; s=arc-20160816; b=Gr/gJvowDbOzlXhHfAakfPz5KsSBEkoQcVYgc71kBwrl6NcxgUtjOdxT9cHow1DmGq YhBHfNSTNfEzvAmULHjgLQRHv+MixyoP76pEUFG7oqsT6qhdjyj4y1IKXZ9QqlAtI1Sq SqtW0pc7y5jt+KAAsWLhDZUgVZGFFHOq3qBNPFXIQYSU1ahGv7FX2PiObPKtww/aU5Vr KYTpnWqomrKABE5dcV+Hb06KdXXmv9wGIr1P4htPhmTVcw74FLxWOnaG+vY6ptzg+yYP G5fNt1i0GpQUXMtkM86nNQkP/M91fE82gM7zD56rA2oo57e5e2uugJ/Ye5WL7K3R4s7e 9jiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8W4DGONJ14Bibgm3pNXmI4YyRAKX5ZNYD4yPVpkOEtg=; fh=kUj/5waaepfljbNx30rj2BALdV0u/mUCTaFWThlgquQ=; b=tiR99krSrBMHfhtdGwVQ8Y3XvJDe8k89+ZXLBzIp5yjRMieKt3418hYH8MTBX+gX6i plIAg3pFedliMNf8S68tlc79iqhJ3Qsn6w/QAcPhgK2o/PW8JYSBk2ht//c0qfBwfni/ 1bWaO55ogQp6ZjbKos28My+lk0Dz0xOFUUGhJCPLhp8QBbYTs0bwCrTFJCf/0ZONIoKZ spLoHfUEAZI2xTqQpHiEoLIqgZUjwvSqTUe1D4BMCLkNQr6ZEfEr5PSGWWGJCVaadIJm +khavh+bEkC7wHnlOCK3h2CJDmsBFcmHHlFIDyjKbh1r0ne/KN5q9WZtvuHKghMDq0Ly 1c2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id nk15-20020a17090b194f00b0027da95531c9si8042012pjb.134.2023.11.06.07.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:50:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 68F5E8025B65; Mon, 6 Nov 2023 07:50:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232880AbjKFPu3 (ORCPT <rfc822;jaysivo@gmail.com> + 35 others); Mon, 6 Nov 2023 10:50:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232564AbjKFPuH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Nov 2023 10:50:07 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EF38D45; Mon, 6 Nov 2023 07:50:04 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SPG0L0dT2zPntQ; Mon, 6 Nov 2023 23:45:54 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 6 Nov 2023 23:50:02 +0800 From: Kefeng Wang <wangkefeng.wang@huawei.com> To: Andrew Morton <akpm@linux-foundation.org> CC: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, Matthew Wilcox <willy@infradead.org>, David Hildenbrand <david@redhat.com>, <linux-s390@vger.kernel.org>, Kefeng Wang <wangkefeng.wang@huawei.com> Subject: [PATCH 08/10] mm: memory: use a folio in insert_page_into_pte_locked() Date: Mon, 6 Nov 2023 23:49:48 +0800 Message-ID: <20231106154950.3399469-9-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231106154950.3399469-1-wangkefeng.wang@huawei.com> References: <20231106154950.3399469-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 07:50:43 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781830353987540195 X-GMAIL-MSGID: 1781830353987540195 |
Series |
mm: convert mm counter to take a folio
|
|
Commit Message
Kefeng Wang
Nov. 6, 2023, 3:49 p.m. UTC
Use a folio in insert_page_into_pte_locked(), which is preparetion
for converting mm counter functions to take a folio.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
mm/memory.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/memory.c b/mm/memory.c index fbed32a09fec..dd3760988e02 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1854,10 +1854,13 @@ static int validate_page_before_insert(struct page *page) static int insert_page_into_pte_locked(struct vm_area_struct *vma, pte_t *pte, unsigned long addr, struct page *page, pgprot_t prot) { + struct folio *folio; + if (!pte_none(ptep_get(pte))) return -EBUSY; + folio = page_folio(page); /* Ok, finally just insert the thing.. */ - get_page(page); + folio_get(folio); inc_mm_counter(vma->vm_mm, mm_counter_file(page)); page_add_file_rmap(page, vma, false); set_pte_at(vma->vm_mm, addr, pte, mk_pte(page, prot));