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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBAA6C433F5 for ; Tue, 12 Apr 2022 09:48:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357438AbiDLJtN (ORCPT ); Tue, 12 Apr 2022 05:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238384AbiDLJm2 (ORCPT ); Tue, 12 Apr 2022 05:42:28 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B341B60DAE for ; Tue, 12 Apr 2022 01:47:22 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6CD2C21608; Tue, 12 Apr 2022 08:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1649753241; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E33CS35xOqn/0jMFES+ln46MItDGxXtgyeeOFfPSYHg=; b=vD1JMVqoVHrbSfjApv7zRM1vbaDtxY2qKh1Zce3DSp8pnGDyANmbL1p5hISeBHomCZVDsU A7B6gQgHXbrKEyQvU+SYNmsHmEFhYfadfMIRf7KMofouj5kmeLIjTfUsZjyMwD433DfsF6 xUiuImzo3IiDtvuN/G+SFzdIRjD1K70= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1649753241; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E33CS35xOqn/0jMFES+ln46MItDGxXtgyeeOFfPSYHg=; b=ONIhPj2uzNWCfXuwgEBX74nJ9V6mJOn8ChK8q6P9aHsUH81STTHiqLpAhmqzvVhB7D5UG5 6DNtM4YvDXopWHDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1770F13780; Tue, 12 Apr 2022 08:47:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gJPwBJk8VWKJHAAAMHmgww (envelope-from ); Tue, 12 Apr 2022 08:47:21 +0000 Message-ID: <4cb92b41-95e1-1666-321e-96ff9e6095bb@suse.cz> Date: Tue, 12 Apr 2022 10:47:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v3 08/16] mm/rmap: drop "compound" parameter from page_add_new_anon_rmap() Content-Language: en-US To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: Andrew Morton , Hugh Dickins , Linus Torvalds , David Rientjes , Shakeel Butt , John Hubbard , Jason Gunthorpe , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Jann Horn , Michal Hocko , Nadav Amit , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Liang Zhang , Pedro Gomes , Oded Gabbay , linux-mm@kvack.org References: <20220329160440.193848-1-david@redhat.com> <20220329160440.193848-9-david@redhat.com> From: Vlastimil Babka In-Reply-To: <20220329160440.193848-9-david@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/29/22 18:04, David Hildenbrand wrote: > New anonymous pages are always mapped natively: only THP/khugepagd code khugepaged ^ > maps a new compound anonymous page and passes "true". Otherwise, we're > just dealing with simple, non-compound pages. > > Let's give the interface clearer semantics and document these. > > Signed-off-by: David Hildenbrand Acked-by: Vlastimil Babka Nit: > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1182,19 +1182,22 @@ void page_add_anon_rmap(struct page *page, > } > > /** > - * page_add_new_anon_rmap - add pte mapping to a new anonymous page > + * page_add_new_anon_rmap - add mapping to a new anonymous page > * @page: the page to add the mapping to > * @vma: the vm area in which the mapping is added > * @address: the user virtual address mapped > - * @compound: charge the page as compound or small page > + * > + * If it's a compound page, it is accounted as a compound page. As the page > + * is new, it's assume to get mapped exclusively by a single process. > * > * Same as page_add_anon_rmap but must only be called on *new* pages. > * This means the inc-and-test can be bypassed. > * Page does not have to be locked. > */ > void page_add_new_anon_rmap(struct page *page, > - struct vm_area_struct *vma, unsigned long address, bool compound) > + struct vm_area_struct *vma, unsigned long address) > { > + const bool compound = PageCompound(page); > int nr = compound ? thp_nr_pages(page) : 1; > > VM_BUG_ON_VMA(address < vma->vm_start || address >= vma->vm_end, vma); There's a VM_BUG_ON_PAGE(PageTransCompound(page), page); later in a !compound branch. Since compound is now determined by the same check, could be deleted.