From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 D3666C433EF for ; Wed, 30 Mar 2022 13:30:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 485018D0002; Wed, 30 Mar 2022 09:30:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 432918D0001; Wed, 30 Mar 2022 09:30:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 321BE8D0002; Wed, 30 Mar 2022 09:30:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 227BA8D0001 for ; Wed, 30 Mar 2022 09:30:11 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DB02A21AA4 for ; Wed, 30 Mar 2022 13:30:10 +0000 (UTC) X-FDA: 79301136180.04.BEE3C18 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf05.hostedemail.com (Postfix) with ESMTP id E2D58100017 for ; Wed, 30 Mar 2022 13:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648647010; x=1680183010; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=tW1fLo6jCq3/8fTF55IDRQFyF2oxcC5H24BleOxUSr4=; b=ESEhyikcCG3klmZyhJuPbHyy5sv93vr8a19hZhN60xvhaCaxRCu5FZt4 fUzJCXEDlo8FtM3I4GxkNNmpuuVXMnhzbuif3p/3pZKnglsOWhJS5H3Yi 5QLZxjVXQjtmS06KNO1HPNV6HmK1HRzVjTWp+FqLN9fZYo/EU0F2oeHnZ ujyifUqpSC0RUT2bsYPlYM9akdqBPvtlVhHmY735XcTl703ujxsj9AYxn H3T139Gjt4Gyvdyc27pdmxLJoGISNR07MXza4KfUf0QQWQSRjoZEGZmwN Z+Zbb8/DlLUp9WJAsM7vq6h5oOgK7ZSCcXK/RaiuZzCxjt2v4PjPkWnQJ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10301"; a="247041608" X-IronPort-AV: E=Sophos;i="5.90,222,1643702400"; d="scan'208";a="247041608" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 06:30:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,222,1643702400"; d="scan'208";a="521891558" Received: from lkp-server02.sh.intel.com (HELO 56431612eabd) ([10.239.97.151]) by orsmga006.jf.intel.com with ESMTP; 30 Mar 2022 06:30:04 -0700 Received: from kbuild by 56431612eabd with local (Exim 4.95) (envelope-from ) id 1nZYOh-00001W-Hs; Wed, 30 Mar 2022 13:30:03 +0000 Date: Wed, 30 Mar 2022 21:29:53 +0800 From: kernel test robot To: cgel.zte@gmail.com, akpm@linux-foundation.org, david@redhat.com, willy@infradead.org Cc: kbuild-all@lists.01.org, corbet@lwn.net, yang.yang29@zte.com.cn, yang.shi@linux.alibaba.com, dave.hansen@linux.intel.com, jhubbard@nvidia.com, saravanand@fb.com, minchan@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, xu xin , Ran Xiaokai Subject: Re: [PATCH v4] mm/vmstat: add events for ksm cow Message-ID: <202203302122.cFR0tu2M-lkp@intel.com> References: <20220330082640.2381401-1-yang.yang29@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220330082640.2381401-1-yang.yang29@zte.com.cn> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E2D58100017 X-Stat-Signature: d3gyfraedhz8wqq5msur57demaqta1f9 X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ESEhyikc; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf05.hostedemail.com: domain of lkp@intel.com has no SPF policy when checking 134.134.136.20) smtp.mailfrom=lkp@intel.com X-HE-Tag: 1648647009-423853 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: Hi, Thank you for the patch! Yet something to improve: [auto build test ERROR on hnaz-mm/master] url: https://github.com/intel-lab-lkp/linux/commits/cgel-zte-gmail-com/mm-vmstat-add-events-for-ksm-cow/20220330-162859 base: https://github.com/hnaz/linux-mm master config: nios2-buildonly-randconfig-r001-20220330 (https://download.01.org/0day-ci/archive/20220330/202203302122.cFR0tu2M-lkp@intel.com/config) compiler: nios2-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/48bd13bff24d30af750dd9429638a2563b758611 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review cgel-zte-gmail-com/mm-vmstat-add-events-for-ksm-cow/20220330-162859 git checkout 48bd13bff24d30af750dd9429638a2563b758611 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nios2 SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): mm/memory.c: In function 'do_wp_page': >> mm/memory.c:3336:32: error: 'COW_KSM' undeclared (first use in this function) 3336 | count_vm_event(COW_KSM); | ^~~~~~~ mm/memory.c:3336:32: note: each undeclared identifier is reported only once for each function it appears in vim +/COW_KSM +3336 mm/memory.c 3229 3230 /* 3231 * This routine handles present pages, when users try to write 3232 * to a shared page. It is done by copying the page to a new address 3233 * and decrementing the shared-page counter for the old page. 3234 * 3235 * Note that this routine assumes that the protection checks have been 3236 * done by the caller (the low-level page fault routine in most cases). 3237 * Thus we can safely just mark it writable once we've done any necessary 3238 * COW. 3239 * 3240 * We also mark the page dirty at this point even though the page will 3241 * change only once the write actually happens. This avoids a few races, 3242 * and potentially makes it more efficient. 3243 * 3244 * We enter with non-exclusive mmap_lock (to exclude vma changes, 3245 * but allow concurrent faults), with pte both mapped and locked. 3246 * We return with mmap_lock still held, but pte unmapped and unlocked. 3247 */ 3248 static vm_fault_t do_wp_page(struct vm_fault *vmf) 3249 __releases(vmf->ptl) 3250 { 3251 struct vm_area_struct *vma = vmf->vma; 3252 3253 if (userfaultfd_pte_wp(vma, *vmf->pte)) { 3254 pte_unmap_unlock(vmf->pte, vmf->ptl); 3255 return handle_userfault(vmf, VM_UFFD_WP); 3256 } 3257 3258 /* 3259 * Userfaultfd write-protect can defer flushes. Ensure the TLB 3260 * is flushed in this case before copying. 3261 */ 3262 if (unlikely(userfaultfd_wp(vmf->vma) && 3263 mm_tlb_flush_pending(vmf->vma->vm_mm))) 3264 flush_tlb_page(vmf->vma, vmf->address); 3265 3266 vmf->page = vm_normal_page(vma, vmf->address, vmf->orig_pte); 3267 if (!vmf->page) { 3268 /* 3269 * VM_MIXEDMAP !pfn_valid() case, or VM_SOFTDIRTY clear on a 3270 * VM_PFNMAP VMA. 3271 * 3272 * We should not cow pages in a shared writeable mapping. 3273 * Just mark the pages writable and/or call ops->pfn_mkwrite. 3274 */ 3275 if ((vma->vm_flags & (VM_WRITE|VM_SHARED)) == 3276 (VM_WRITE|VM_SHARED)) 3277 return wp_pfn_shared(vmf); 3278 3279 pte_unmap_unlock(vmf->pte, vmf->ptl); 3280 return wp_page_copy(vmf); 3281 } 3282 3283 /* 3284 * Take out anonymous pages first, anonymous shared vmas are 3285 * not dirty accountable. 3286 */ 3287 if (PageAnon(vmf->page)) { 3288 struct page *page = vmf->page; 3289 3290 /* 3291 * We have to verify under page lock: these early checks are 3292 * just an optimization to avoid locking the page and freeing 3293 * the swapcache if there is little hope that we can reuse. 3294 * 3295 * PageKsm() doesn't necessarily raise the page refcount. 3296 */ 3297 if (PageKsm(page) || page_count(page) > 3) 3298 goto copy; 3299 if (!PageLRU(page)) 3300 /* 3301 * Note: We cannot easily detect+handle references from 3302 * remote LRU pagevecs or references to PageLRU() pages. 3303 */ 3304 lru_add_drain(); 3305 if (page_count(page) > 1 + PageSwapCache(page)) 3306 goto copy; 3307 if (!trylock_page(page)) 3308 goto copy; 3309 if (PageSwapCache(page)) 3310 try_to_free_swap(page); 3311 if (PageKsm(page) || page_count(page) != 1) { 3312 unlock_page(page); 3313 goto copy; 3314 } 3315 /* 3316 * Ok, we've got the only page reference from our mapping 3317 * and the page is locked, it's dark out, and we're wearing 3318 * sunglasses. Hit it. 3319 */ 3320 unlock_page(page); 3321 wp_page_reuse(vmf); 3322 return VM_FAULT_WRITE; 3323 } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) == 3324 (VM_WRITE|VM_SHARED))) { 3325 return wp_page_shared(vmf); 3326 } 3327 copy: 3328 /* 3329 * Ok, we need to copy. Oh, well.. 3330 */ 3331 get_page(vmf->page); 3332 3333 pte_unmap_unlock(vmf->pte, vmf->ptl); 3334 #ifdef CONFIG_KSM 3335 if (PageKsm(vmf->page)) > 3336 count_vm_event(COW_KSM); 3337 #endif 3338 return wp_page_copy(vmf); 3339 } 3340 -- 0-DAY CI Kernel Test Service https://01.org/lkp