From nobody Thu Dec 18 10:00:10 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 C55121D516D for ; Wed, 12 Feb 2025 02:59:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739329154; cv=none; b=u907n4kdOfqbOXE3q+nKJtVoFIphCsfHjyekU14/gjn+DdFLmC0wrCPsK+GZs9Rum0VOwRCeZ4IuriJDpnL2RQPn1APHLV9824mQYPktSFeLhp03uMbVUxX2E2Zd6916KK/8jC93AfyWinWFRt5+aH+2lNCYQ59LZ8Q45rKK2uU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739329154; c=relaxed/simple; bh=grLQdsLQ1ZkH/aIIT1aXQVNhT1FavSq/NtUxMMtW/PM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qFQ43w3edEct+cfK75CjvkXhRw/XzrZSNIO9XDbqWH0MP8LXWDt+MyOrGO2AZS55icfIxh07zHKdE6N61Ym5Z91OnnNH3f82F1oULejjVESCCyENC/3cB76Ckg19+7jLnhR2eR8cGz8J62M9EHvDYj5NAbxiIFTChyvPLIu7aqI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 4eb44d2ee8ed11efa216b1d71e6e1362-20250212 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CC_NO_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_DIGIT_LEN, HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM HR_SJ_PHRASE, HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT HR_TO_NO_NAME, DN_TRUSTED, SRC_TRUSTED, SA_TRUSTED, SA_EXISTED SN_TRUSTED, SN_EXISTED, SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS CIE_BAD, CIE_GOOD, CIE_GOOD_SPF, GTI_FG_BS, GTI_RG_INFO GTI_C_BU, AMN_T1, AMN_GOOD, AMN_C_TI, AMN_C_BU ABX_MISS_RDNS X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:30c93d93-f2fd-4b6a-ad32-cddf86305237,IP:10, URL:0,TC:0,Content:-5,EDM:-25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,AC TION:release,TS:-25 X-CID-INFO: VERSION:1.1.45,REQID:30c93d93-f2fd-4b6a-ad32-cddf86305237,IP:10,UR L:0,TC:0,Content:-5,EDM:-25,RT:0,SF:-5,FILE:0,BULK:0,RULE:EDM_GE969F26,ACT ION:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:554b448c421ed6c24026b7b687b4ed6b,BulkI D:250212100238CDFLER86,BulkQuantity:3,Recheck:0,SF:17|19|25|38|45|66|78|81 |82|102,TC:nil,Content:0|50,EDM:1,IP:-2,URL:11|1,File:nil,RT:nil,Bulk:40,Q S:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0, ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI, TF_CID_SPAM_ULN X-UUID: 4eb44d2ee8ed11efa216b1d71e6e1362-20250212 X-User: liuye@kylinos.cn Received: from localhost.localdomain [(223.70.253.31)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 999580327; Wed, 12 Feb 2025 10:58:59 +0800 From: Liu Ye To: brauner@kernel.org, dhowells@redhat.com, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Liu Ye Subject: [PATCH 1/2] mm/folio_queue: Delete __folio_order and use folio_order directly Date: Wed, 12 Feb 2025 10:58:42 +0800 Message-Id: <20250212025843.80283-2-liuye@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250212025843.80283-1-liuye@kylinos.cn> References: <20250212025843.80283-1-liuye@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" __folio_order is the same as folio_order, remove __folio_order and then just include mm.h and use folio_order directly. Signed-off-by: Liu Ye Acked-by: David Howells Reviewed-by: Dev Jain Reviewed-by: Shivank Garg --- include/linux/folio_queue.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/include/linux/folio_queue.h b/include/linux/folio_queue.h index 4d3f8074c137..45ad2408a80c 100644 --- a/include/linux/folio_queue.h +++ b/include/linux/folio_queue.h @@ -15,6 +15,7 @@ #define _LINUX_FOLIO_QUEUE_H =20 #include +#include =20 /* * Segment in a queue of running buffers. Each segment can hold a number = of @@ -216,13 +217,6 @@ static inline void folioq_unmark3(struct folio_queue *= folioq, unsigned int slot) clear_bit(slot, &folioq->marks3); } =20 -static inline unsigned int __folio_order(struct folio *folio) -{ - if (!folio_test_large(folio)) - return 0; - return folio->_flags_1 & 0xff; -} - /** * folioq_append: Add a folio to a folio queue segment * @folioq: The segment to add to @@ -241,7 +235,7 @@ static inline unsigned int folioq_append(struct folio_q= ueue *folioq, struct foli unsigned int slot =3D folioq->vec.nr++; =20 folioq->vec.folios[slot] =3D folio; - folioq->orders[slot] =3D __folio_order(folio); + folioq->orders[slot] =3D folio_order(folio); return slot; } =20 @@ -263,7 +257,7 @@ static inline unsigned int folioq_append_mark(struct fo= lio_queue *folioq, struct unsigned int slot =3D folioq->vec.nr++; =20 folioq->vec.folios[slot] =3D folio; - folioq->orders[slot] =3D __folio_order(folio); + folioq->orders[slot] =3D folio_order(folio); folioq_mark(folioq, slot); return slot; } --=20 2.25.1 From nobody Thu Dec 18 10:00:10 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 C54AF1B21AD for ; Wed, 12 Feb 2025 02:59:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739329155; cv=none; b=PQLAKkkxZ1yXFvsKVCRD92FPAhdVY8SJl3QniYJbzJxl1JnM83DufSWuEpSI5MRCTlKfx8MrkfBsBhkB2ON54JXIrbO+BPq1DRcKyVd48UhvysCWWkRIBx4t6VItJr52gjhUDLx9jRaR+28UztIny/CEjyk/9cv9YsmXCneGWy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739329155; c=relaxed/simple; bh=7CUfID6HdZsryrIInsAKRbRo8sqorcpQZFpxldomQjg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IoKrj3yN2oqR/3C7PcBrljOPdG7i10SVVAjP1sZz6kVtxtzsvGiM92gElIxRgzw0Qg/5FhxXAmWTRx3DRUteOZFjZN6mZ7gpGYLzcStD8KncohtLTfSrnBCoLyNROXdYoL5y6/416sE9x1/EkEEkegGoeTAckJr6KIIi8AcGrXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 4f8e10d6e8ed11efa216b1d71e6e1362-20250212 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CC_NO_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_DIGIT_LEN, HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM HR_SJ_PHRASE, HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT HR_TO_NO_NAME, DN_TRUSTED, SRC_TRUSTED, SA_TRUSTED, SA_EXISTED SN_TRUSTED, SN_EXISTED, SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS CIE_BAD, CIE_GOOD, CIE_GOOD_SPF, GTI_FG_BS, GTI_RG_INFO GTI_C_BU, AMN_T1, AMN_GOOD, AMN_C_TI, AMN_C_BU ABX_MISS_RDNS X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:f4ca7371-eeee-4ed1-970f-69c577e032f3,IP:10, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:5 X-CID-INFO: VERSION:1.1.45,REQID:f4ca7371-eeee-4ed1-970f-69c577e032f3,IP:10,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:5 X-CID-META: VersionHash:6493067,CLOUDID:d49b93826a871673d7c8b078915368c3,BulkI D:250212100240HKQ61LWW,BulkQuantity:3,Recheck:0,SF:17|19|25|38|45|66|78|81 |82|102,TC:nil,Content:0|50,EDM:-3,IP:-2,URL:0,File:nil,RT:nil,Bulk:40,QS: nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,AR C:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 4f8e10d6e8ed11efa216b1d71e6e1362-20250212 X-User: liuye@kylinos.cn Received: from localhost.localdomain [(223.70.253.31)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1944486207; Wed, 12 Feb 2025 10:59:01 +0800 From: Liu Ye To: brauner@kernel.org, dhowells@redhat.com, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Liu Ye Subject: [PATCH 2/2] mm/mm.h: Write folio->_flags_1 & 0xff as a macro definition Date: Wed, 12 Feb 2025 10:58:43 +0800 Message-Id: <20250212025843.80283-3-liuye@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250212025843.80283-1-liuye@kylinos.cn> References: <20250212025843.80283-1-liuye@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There are multiple locations in mm.h where (folio->_flags_1 & 0xff) is used. Write it as a macro definition to improve the readability and maintainability of the code. Signed-off-by: Liu Ye --- include/linux/mm.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7b1068ddcbb7..750e75f45557 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1098,6 +1098,8 @@ int vma_is_stack_for_current(struct vm_area_struct *v= ma); struct mmu_gather; struct inode; =20 +#define FOLIO_ORDER(folio) ((folio)->_flags_1 & 0xff) + /* * compound_order() can be called without holding a reference, which means * that niceties like page_folio() don't work. These callers should be @@ -1111,7 +1113,7 @@ static inline unsigned int compound_order(struct page= *page) =20 if (!test_bit(PG_head, &folio->flags)) return 0; - return folio->_flags_1 & 0xff; + return FOLIO_ORDER(folio); } =20 /** @@ -1127,7 +1129,7 @@ static inline unsigned int folio_order(const struct f= olio *folio) { if (!folio_test_large(folio)) return 0; - return folio->_flags_1 & 0xff; + return FOLIO_ORDER(folio); } =20 #include @@ -2061,7 +2063,7 @@ static inline long folio_nr_pages(const struct folio = *folio) #ifdef CONFIG_64BIT return folio->_folio_nr_pages; #else - return 1L << (folio->_flags_1 & 0xff); + return 1L << FOLIO_ORDER(folio); #endif } =20 @@ -2086,7 +2088,7 @@ static inline unsigned long compound_nr(struct page *= page) #ifdef CONFIG_64BIT return folio->_folio_nr_pages; #else - return 1L << (folio->_flags_1 & 0xff); + return 1L << FOLIO_ORDER(folio); #endif } =20 --=20 2.25.1