diff mbox series

accel/qaic: Update MAX_ORDER use to be inclusive

Message ID 20231103153302.20642-1-quic_jhugo@quicinc.com (mailing list archive)
State New, archived
Headers show
Series accel/qaic: Update MAX_ORDER use to be inclusive | expand

Commit Message

Jeffrey Hugo Nov. 3, 2023, 3:33 p.m. UTC
MAX_ORDER was redefined so that valid allocations to the page allocator
are in the range of 0..MAX_ORDER, inclusive in the commit
23baf831a32c ("mm, treewide: redefine MAX_ORDER sanely").

We are treating MAX_ORDER as an exclusive value, and thus could be
requesting larger allocations.  Update our use to match the redefinition
of MAX_ORDER.

Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
---
 drivers/accel/qaic/qaic_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jacek Lawrynowicz Nov. 6, 2023, 7:20 a.m. UTC | #1
On 03.11.2023 16:33, Jeffrey Hugo wrote:
> MAX_ORDER was redefined so that valid allocations to the page allocator
> are in the range of 0..MAX_ORDER, inclusive in the commit
> 23baf831a32c ("mm, treewide: redefine MAX_ORDER sanely").
> 
> We are treating MAX_ORDER as an exclusive value, and thus could be
> requesting larger allocations.  Update our use to match the redefinition
> of MAX_ORDER.
> 
> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
> ---
>  drivers/accel/qaic/qaic_data.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
> index 8da81768f2ab..8998c28e566e 100644
> --- a/drivers/accel/qaic/qaic_data.c
> +++ b/drivers/accel/qaic/qaic_data.c
> @@ -452,7 +452,7 @@ static int create_sgt(struct qaic_device *qdev, struct sg_table **sgt_out, u64 s
>  		 * later
>  		 */
>  		buf_extra = (PAGE_SIZE - size % PAGE_SIZE) % PAGE_SIZE;
> -		max_order = min(MAX_ORDER - 1, get_order(size));
> +		max_order = min(MAX_ORDER, get_order(size));
>  	} else {
>  		/* allocate a single page for book keeping */
>  		nr_pages = 1;

Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Jeffrey Hugo Nov. 17, 2023, 5:49 p.m. UTC | #2
On 11/3/2023 9:33 AM, Jeffrey Hugo wrote:
> MAX_ORDER was redefined so that valid allocations to the page allocator
> are in the range of 0..MAX_ORDER, inclusive in the commit
> 23baf831a32c ("mm, treewide: redefine MAX_ORDER sanely").
> 
> We are treating MAX_ORDER as an exclusive value, and thus could be
> requesting larger allocations.  Update our use to match the redefinition
> of MAX_ORDER.
> 
> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>

Applied to drm-misc-next

-Jeff
diff mbox series

Patch

diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
index 8da81768f2ab..8998c28e566e 100644
--- a/drivers/accel/qaic/qaic_data.c
+++ b/drivers/accel/qaic/qaic_data.c
@@ -452,7 +452,7 @@  static int create_sgt(struct qaic_device *qdev, struct sg_table **sgt_out, u64 s
 		 * later
 		 */
 		buf_extra = (PAGE_SIZE - size % PAGE_SIZE) % PAGE_SIZE;
-		max_order = min(MAX_ORDER - 1, get_order(size));
+		max_order = min(MAX_ORDER, get_order(size));
 	} else {
 		/* allocate a single page for book keeping */
 		nr_pages = 1;