问题描述:
[ 771.379814] BUG: Bad page state in process pesdk pfn:5aa5c [ 771.452077] page:ffffea00016a9700 count:-1 mapcount:0 mapping: (null) index:0x0 [ 771.559752] page flags: 0x1fffff00000000() [ 771.612599] page dumped because: nonzero _count [ 771.672223] Modules linked in: phy88e1548(OE) pe_sdk_ko_ts(OE) ip6t_rpfilter ipt_REJECT nf_reject_ipv4 ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter vfat fat sha512_ssse3 sha512_generic drbg ansi_cprng edac_core intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul iTCO_wdt glue_helper iTCO_vendor_support ablk_helper cryptd qat_c62x pcspkr sg intel_qat dh_generic mei_me rsa_generic mei authenc i2c_i801 shpchp ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic uas igb i2c_algo_bit i2c_core dca e1000e i40e ahci libahci libata crct10dif_pclmul crct10dif_common crc32c_intel serio_raw usb_storage ptp pps_core [ 772.869305] CPU: 0 PID: 10844 Comm: pesdk Tainted: G B OE ------------ 3.10.0-693.el7.x86_64 #1 [ 772.996582] Hardware name: Default string Default string/Default string, BIOS 0.06 07/24/2020 [ 773.111138] ffffea00016a9700 000000007c801a27 ffff88045ebdfaa8 ffffffff816a3d91 [ 773.207558] ffff88045ebdfad0 ffffffff8169f40f 0000000000000800 00000000000007ab [ 773.305021] ffffea00016a9700 ffff88045ebdfbe0 ffffffff8118c808 ffffffff811a31b8 [ 773.402486] Call Trace: [ 773.435638] [<ffffffff816a3d91>] dump_stack+0x19/0x1b [ 773.502243] [<ffffffff8169f40f>] bad_page.part.75+0xdc/0xf9 [ 773.576776] [<ffffffff8118c808>] get_page_from_freelist+0x868/0x9e0 [ 773.660479] [<ffffffff811a31b8>] ? zone_statistics+0x88/0xa0 [ 773.736170] [<ffffffff8118caf6>] __alloc_pages_nodemask+0x176/0x420 [ 773.819865] [<ffffffffc0576a77>] ? pe_memset+0x57/0x90 [pe_sdk_ko_ts] [ 773.905859] [<ffffffff811d1108>] alloc_pages_current+0x98/0x110 [ 773.984977] [<ffffffff8118760e>] __get_free_pages+0xe/0x40 [ 774.058364] [<ffffffffc057ba04>] drv_fpga_alloc_one+0xf4/0x320 [pe_sdk_ko_ts] [ 774.153531] [<ffffffffc057af85>] pe_send_buf+0xa5/0x150 [pe_sdk_ko_ts] [ 774.240675] [<ffffffffc057c1e7>] drv_fpga_send_pkt+0x57/0xa0 [pe_sdk_ko_ts] [ 774.333551] [<ffffffffc057844f>] pe_sdk_send_packets+0xef/0x200 [pe_sdk_ko_ts] [ 774.429870] [<ffffffffc057857e>] pe_sdk_send_packets_thread+0x1e/0x80 [pe_sdk_ko_ts] [ 774.533063] [<ffffffffc057434d>] pe_sdk_ko_ioctl+0x32d/0x4b0 [pe_sdk_ko_ts] [ 774.625943] [<ffffffff812151cd>] do_vfs_ioctl+0x33d/0x540 [ 774.698178] [<ffffffff816affd1>] ? __do_page_fault+0x171/0x450 [ 774.777192] [<ffffffff81215471>] SyS_ioctl+0xa1/0xc0 [ 774.842653] [<ffffffff816b4fc9>] system_call_fastpath+0x16/0x1b
问题原因:
通过__get_free_page(GFP_AMD32)函数申请的内存,通过free_page()函数进行释放时,进行了多次释放,改为1次释放,可解决问题。