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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61582C2D0EE for ; Thu, 26 Mar 2020 12:44:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2743E2073E for ; Thu, 26 Mar 2020 12:44:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="HgT2+ZWq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2743E2073E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C6CE16B0095; Thu, 26 Mar 2020 08:44:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF7456B0096; Thu, 26 Mar 2020 08:44:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A97D86B0098; Thu, 26 Mar 2020 08:44:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 8E74C6B0095 for ; Thu, 26 Mar 2020 08:44:51 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7E003181AD0A5 for ; Thu, 26 Mar 2020 12:44:51 +0000 (UTC) X-FDA: 76637482782.19.part95_64212b6aa1737 X-HE-Tag: part95_64212b6aa1737 X-Filterd-Recvd-Size: 3210 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Mar 2020 12:44:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=T/g5zYQ/IY8vQN8Q10rUYZvaI2MWyMueldruMEuSQnc=; b=HgT2+ZWqRx0rWdKg/5Wd7YXbmh 0Ri3jbL/u/dBQ6dq4PM4FTLHHkeyW+51vJLIVd+SRXXRHbfZYjq+8RqV5dzYY/eHCPoKDhv4WUXPb nLVSF9qWWwA3Q64P0iUx29aclieenvaASSpdTLlpkIRUsANc/3aWG3ZqHYamEeV+UaXfin9f7ftnK hmqZvKM75uCSI+QZSaxYXBR2VkmVAe8LsjE9m7uZRC+JxRGOWm7QOcNdxfUFgLop73BPsmwxVRade s3332CvPz7WImOOsgQwpVq7MrbbKD3il8bVETfuNDMM/FgowP1ShM4BqOCPnTOxTJIDAHF3wCL9+H 3MOuy/fw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHRsJ-0005tN-A5; Thu, 26 Mar 2020 12:44:43 +0000 Date: Thu, 26 Mar 2020 05:44:43 -0700 From: Matthew Wilcox To: Jan Kara Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 2/2] mm: Use clear_bit_unlock_is_negative_byte for PageWriteback Message-ID: <20200326124443.GG22483@bombadil.infradead.org> References: <20200326122429.20710-1-willy@infradead.org> <20200326122429.20710-3-willy@infradead.org> <20200326124047.GA13756@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200326124047.GA13756@quack2.suse.cz> 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: On Thu, Mar 26, 2020 at 01:40:47PM +0100, Jan Kara wrote: > On Thu 26-03-20 05:24:29, Matthew Wilcox wrote: > > From: "Matthew Wilcox (Oracle)" > > > > By moving PG_writeback down into the low bits of the page flags, we can > > use clear_bit_unlock_is_negative_byte() for writeback as well as the > > lock bit. wake_up_page() then has no more callers. Given the other > > code being executed between the clear and the test, this is not going > > to be as dramatic a win as it was for PageLocked, but symmetry between > > the two is nice and lets us remove some code. > > > > Signed-off-by: Matthew Wilcox (Oracle) > > The patch looks good to me. Just one nit: > > > + VM_BUG_ON_PAGE(!PageWriteback(page), page); > > + if (__clear_page_writeback(page)) > > + wake_up_page_bit(page, PG_writeback); > > Since __clear_page_writeback() isn't really prepared for PageWriteback() > not being set, can we move the VM_BUG_ON_PAGE() there? Otherwise feel free > to add: > > Reviewed-by: Jan Kara Thanks! I put it there to be parallel to the PageLocked equivalent: void unlock_page(struct page *page) { BUILD_BUG_ON(PG_waiters != 7); BUILD_BUG_ON(PG_locked > 7); page = compound_head(page); VM_BUG_ON_PAGE(!PageLocked(page), page); if (clear_bit_unlock_is_negative_byte(PG_locked, &page->flags)) wake_up_page_bit(page, PG_locked); } but one could equally well argue it should be in __clear_page_writeback instead.